Catman...::Atom(3pm)
β¨ NAME β¨
Catmandu::Exporter::Atom β bestie, it's an Atom exporter. That's the whole thing. That's the vibe. π
This is the Catman...::Atom(3pm) page from the User Contributed Perl Documentation, and we're gonna walk through it together, no skimming, no skipping. π«Ά
π SYNOPSIS π
Okay so first things first, you gotta use it. Obviously. β¨
use Catmandu::Exporter::Atom;
Then you set up your blog args β id, title, subtitle, icon, generator, rights, your links, your authors, your contributors, your namespaces, all of it. Look at this gorgeous little hash: π
my $blog_args = {
id => "urn:uuid:60a76c80-d399-11d9-b91C-0003939e0af6" ,
title => "My Blog" ,
subtitle => "testing 1.2.3" ,
icon => "http://icons.org/test.jpg" ,
generator => "Catmandu::Exporter::Atom" ,
rights => "Beer license",
link => [
{
'type' => 'text/html' ,
'rel' => 'alternate' ,
'href' => 'http://www.example.com' ,
}
],
author => [
{
'name' => 'Daffy' ,
'email' => 'duck@toons.be' ,
}
] ,
contributor => [
{
'name' => 'Bugs' ,
'email' => 'bunny@toons.be'
}
],
ns => {
'dc' => 'http://purl.org/dc/elements/1.1/',
},
'dc:source' => 'test',
};
Then you make the exporter, and then you feed it things. Three ways to feed it, actually: π
my $exporter = Catmandu::Exporter::Atom->new(%$blog_args);
$exporter->add_many($arrayref);
$exporter->add_many($iterator);
$exporter->add_many(sub { });
$exporter->add($hashref);
And here's a fully loaded add so you can see what a real object looks like walking in the door β title, subtitle, content, summary, id, author, contributor, links, categories, rights, and a dc:subject for spice. iconic π«
$exporter->add({
'title' => 'My Little Pony' ,
'subtitle' => 'Data testing for you and me' ,
'content' => "sdsadas" ,
'summary' => 'Brol 123' ,
'id' => '1291821827128172817' ,
'author' => {
'name' => 'John Doe' ,
'email' => 'john@farwaway.org' ,
} ,
'contributor' => {
'name' => 'Rabbit, R' ,
'email' => 'r.rabbit@farwaway.org' ,
'homepage' => 'http://faraway.org/~rabbit' ,
} ,
'link' => [
{
'type' => 'text/html' ,
'rel' => 'alternate' ,
'href' => 'http://www.example.com' ,
'title' => 'Test test' ,
'length' => '1231' ,
'hreflang' => 'eng' ,
} ,
{
'type' => 'text/html' ,
'rel' => 'alternate' ,
'href' => 'http://www.example2.com' ,
}
] ,
'category' => [
{
'scheme' => 'http://localhost:8080/roller/adminblog' ,
'term' => 'Music',
}
] ,
'rights' => 'Yadadada',
'dc:subject' => 'Toyz',
});
And then, the flex β you count how many you exported and you print it: π
printf "exported %d objects\n" , $exporter->count;
πΈ Add one object πΈ
Just one. A little single object. A snack. π
use Catmandu::Exporter::Atom;
my $exporter = Catmandu::Exporter::Atom->new();
print $exporter->add($hashref);
πΈ Add many objects to exporter πΈ
Now we're doing volume, bestie. Main character energy. β¨
use Catmandu::Exporter::Atom;
my $exporter = Catmandu::Exporter::Atom->new();
print $exporter->add_many($arrayref);
πΈ Add many objects from an iterator πΈ
Same energy, but the objects come from an iterator this time. π
use Catmandu::Exporter::Atom;
my $exporter = Catmandu::Exporter::Atom->new();
my $iterator = Catmandu::Importer::
print
ngl bestie, that example literally just ends there in the page. I'm not gonna invent the rest for you β what you see is what's on the page. π
πΈ Fix your data while exporting the data πΈ
You can run a fix file while the export is happening. Point it at fix.txt and let it cook: π₯
use Catmandu::Exporter::Atom;
my $exporter = Catmandu::Exporter::Atom->new(fix => 'fix.txt');
# where fix.txt looks for example:
# add_field()
# delete
# mv
print $exporter->add($data);
π SEE ALSO π
Catmandu::Exporterβ go look at that one too, iykyk π
Okay that's the whole page, you ate it, I'm so proud. π₯Ή This one's from perl v5.36.0, dated 2022-12-10, and it lives on the Catman...::Atom(3pm) page. Bye bestie, go export something beautiful! πβ¨π¦
π¦ where this page comes from
- debian bookworm: libcatmandu-atom-perl 0.05-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libcatmandu-atom-perl 0.05-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libcatmandu-atom-perl 0.05-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu questing: libcatmandu-atom-perl 0.05-2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms