Scroll to navigation

Catmandu::Importer::Atom(3pm) User Contributed Perl Documentation Catmandu::Importer::Atom(3pm)

NAME

Catmandu::Importer::Atom - Package that imports Atom feeds

SYNOPSIS

    use Catmandu::Importer::Atom;
    my $importer = Catmandu::Importer::Atom->new(url => "...");
    my $n = $importer->each(sub {
        my $hashref = $_[0];
        # ...
    });

DATA MODEL

Each parsed Atom entry is transformed into a hash ref:

    {
        id         => '...' ,
        title      => '...' ,
        published  => '...' , 
        updated    => '...' ,
        summary    => '...' ,
        rights     => '...' ,
        content    => {
            mode => '...' ,
            type => '...' ,
            body => '...' ,
        } ,
        author     => {
            name  => '...' ,
            email => '...' ,
            uri   => '...' ,
            homepage => '...' ,
        } ,
        contributor => {
            name  => '...' ,
            email => '...' ,
            uri   => '...' ,
            homepage => '...' ,
        } ,
        category => [
            { term => '...' , label => '...' , scheme => '....' } ,
        ],
        link => [
            { rel => '...' , href => '...' , hreflang => '...' ,
              title => '...' , type => '...' , length => '...'} ,
        ],
        <<all other elements are added as name-value pairs>>
    }

METHODS

new(url => URL,[entries => [qw(...)])

Create a new Atom importer for the URL. Optionally provide a entries parameter with the feed items you want to import.

count

each(&callback)

...

Every Catmandu::Importer is a Catmandu::Iterable all its methods are inherited. The Catmandu::Importer::Atom methods are not idempotent: Atom feeds can only be read once.

SEE ALSO

Catmandu::Iterable

2022-12-10 perl v5.36.0