| Catmandu::Importer::YAML(3pm) | User Contributed Perl Documentation | Catmandu::Importer::YAML(3pm) |
Catmandu::Importer::YAML - Package that imports YAML data
# From the command line
$ catmandu convert YAML to JSON < data.yaml
# In a Perl script
use Catmandu;
my $importer = Catmandu->importer('YAML',file => "/foo/bar.yaml");
my $n = $importer->each(sub {
my $hashref = $_[0];
# ...
});
The YAML input file needs to be separated into records:
---
- recordno: 1
- name: Alpha
---
- recordno: 2
- name: Beta
...
where '---' is the record separator and '...' the EOF indicator.
Every Catmandu::Importer is a Catmandu::Iterable all its methods are inherited. The Catmandu::Importer::YAML methods are not idempotent: YAML feeds can only be read once.
Catmandu::Exporter::YAML
| 2023-03-03 | perl v5.36.0 |