NAME
Catmandu::Importer::YAML - Package that imports YAML data
SYNOPSIS
use Catmandu::Importer::YAML;
my $importer = Catmandu::Importer::YAML->new(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.
METHODS
new(file => $filename, fh => $fh , fix => [...])
Create a new YAML importer for $filename. Use STDIN when no filename is given.
The constructor inherits the fix parameter from Catmandu::Fixable. When given, then any fix or fix script will be applied to imported items.
count
each(&callback)
...
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.