Catmandu::Importer::YAML - Package that imports YAML data
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.
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.
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::Iterable
To install Catmandu, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catmandu
CPAN shell
perl -MCPAN -e shell install Catmandu
For more information on module installation, please visit the detailed CPAN module installation guide.