Nicolas Steenlant > Catmandu > Catmandu::Importer

Download:
Catmandu-0.8014.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Source  

NAME ^

Catmandu::Importer - Namespace for packages that can import

SYNOPSIS ^

    use Catmandu::Importer::JSON;

    my $importer = Catmandu::Importer::JSON->new(file => "/foo/bar.json");

    my $n = $importer->each(sub {
        my $hashref = $_[0];
        # ...
    });

DESCRIPTION ^

A Catmandu::Importer is a stub for Perl packages that can import data from an external source (a file, the network, ...).

Every Catmandu::Importer is a Catmandu::Fixable and thus provides a 'fix' parameter that can be set in the constructor. For every item returned by the generator the given fixes will be applied first.

METHODS ^

new(file => $file , encoding => $encoding )

Create a new importer reading input from a local file: $file is a string containing the path to the file.

new(fh => $fh , encoding => $encoding)

Create a new importer by reading from a IO::Handle. Optionally use Catmandu::Util::io to create IO::Handles.

count

each(&callback)

...

Every Catmandu::Importer is a Catmandu::Iterable all its methods are inherited.

log

Return the current logger.

SEE ALSO ^

Catmandu::Iterable , Catmandu::Util

syntax highlighting: