Scroll to navigation

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

NAME

Catmandu::Exporter::Atom - an Atom exporter

SYNOPSIS

    use Catmandu::Exporter::Atom;
    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',
    };
    
    my $exporter = Catmandu::Exporter::Atom->new(%$blog_args);
    $exporter->add_many($arrayref);
    $exporter->add_many($iterator);
    $exporter->add_many(sub { });
    $exporter->add($hashref);
    
    $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',
    });
    printf "exported %d objects\n" , $exporter->count;

Add one object

    use Catmandu::Exporter::Atom;
    my $exporter = Catmandu::Exporter::Atom->new();
    print $exporter->add($hashref);

Add many objects to exporter

    use Catmandu::Exporter::Atom;
    my $exporter = Catmandu::Exporter::Atom->new();
    print $exporter->add_many($arrayref);

Add many objects from an iterator

    use Catmandu::Exporter::Atom;
    my $exporter = Catmandu::Exporter::Atom->new();
    my $iterator = Catmandu::Importer::
    print

Fix your data while exporting the data

    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
2014-07-02 perl v5.18.2