Catman...::Atom(3pm)

πŸ“¦
version 0.05 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu questing

πŸ’– NAME πŸ’–

Catmandu::Importer::Atom β€” the package that imports Atom feeds. that's it, that's the whole job. (also hi, you're reading Catman...::Atom(3pm) from the User Contributed Perl Documentation, love that for us 🫢)


✨ SYNOPSIS ✨

okay so bestie, here's the vibe:

use Catmandu::Importer::Atom;

my $importer = Catmandu::Importer::Atom->new(url => "...");

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

πŸ¦‹ DATA MODEL πŸ¦‹

every single parsed Atom entry gets transformed into a hash ref, and it looks exactly like this, no notes:

{
    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>>
}

literally every field is right there β€” id, title, published, updated, summary, rights, the whole content block, author, contributor, category, link, and then whatever else shows up gets tossed in as name-value pairs. iconic. πŸ‘‘


πŸ’… METHODS πŸ’…

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

spin up a brand new Atom importer for that URL. and if you want, you can also hand it an entries parameter listing the feed items you actually wanna import. picky eating, but make it valid. πŸ“

🌈 count

🌈 each(&callback)

🌈 ...

every single Catmandu::Importer is a Catmandu::Iterable, so all its methods get inherited β€” you get the whole family, fr fr. but heads up on the Catmandu::Importer::Atom methods specifically:

🚨 not idempotent!! 🚨 Atom feeds can only be read once. that's it. one shot. do not come back for seconds, because there is no seconds. 😭

πŸ”₯ SEE ALSO πŸ”₯

  • Catmandu::Iterable β€” go look, iykyk

and that's the whole page, bestie πŸ’œ this was perl v5.36.0, dated 2022-12-10 β€” mwah, take care of her, she's vintage βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from