English Japanese Kawa.netxp [Perl] XML::FeedPP - Parse/write/merge/edit RSS/RDF/Atom syndication feeds

XML::FeedPP is an all-purpose syndication utility that parses and publishes RSS 2.0, RSS 1.0 (RDF), Atom 0.3 and 1.0 feeds.
It allows you to add new content, merge feeds, and convert among various formats.
It is a pure Perl implementation and does not require any other module except for XML::TreePP.

Released version: XML-FeedPP-0.43.tar.gz TARGZ CPAN

Subversion repository: http://xml-treepp.googlecode.com/svn/trunk/XML-FeedPP/ SVN

Documents: README README Changes Changes

Join the XML::FeedPP Group on Yahoo! Groups to discuss about the module.
And annotating documents is welcome.

Examples

Get a RSS file from remote web server and parse it.

    my $source = 'http://use.perl.org/index.rss';
    my $feed = XML::FeedPP->new( $source );
    print "Title: ", $feed->title(), "\n";
    print "Date: ", $feed->pubDate(), "\n";
    foreach my $item ( $feed->get_item() ) {
        print "URL: ", $item->link(), "\n";
        print "Title: ", $item->title(), "\n";
    }

Generate a RDF file and save it as local file.

    my $feed = XML::FeedPP::RDF->new();
    $feed->title( "use Perl" );
    $feed->link( "http://use.perl.org/" );
    $feed->pubDate( "Thu, 23 Feb 2006 14:43:43 +0900" );
    my $item = $feed->add_item( "http://search.cpan.org/~kawasaki/XML-TreePP-0.02" );
    $item->title( "Pure Perl implementation for parsing/writing xml file" );
    $item->pubDate( "2006-02-23T14:43:43+09:00" );
    $feed->to_file( "index.rdf" );

Merge some RSS/RDF files and convert it into Atom format.

    my $feed = XML::FeedPP::Atom::Atom10->new();          # create empty atom file
    $feed->merge( "rss.xml" );                          # load local RSS file
    $feed->merge( "http://www.kawa.net/index.rdf" );    # load remote RDF file
    my $now = time();
    $feed->pubDate( $now );                             # touch date
    my $atom = $feed->to_string();                      # get Atom source code

Install

Requirements: XML::TreePP module with Perl 5.005, 5.6.x, 5.8.x or above.

$ tar zxvf XML-FeedPP-0.03.tar.gz
$ cd XML-FeedPP-0.03
$ perl Makefile.PL
Writing Makefile for XML-FeedPP
$ make
cp lib/XML/FeedPP.pm blib/lib/XML/FeedPP.pm
Manifying blib/man3/XML::FeedPP.3
$ make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/atom........ok
t/datetime....ok
t/encoding....ok
        1/4 skipped: Encode.pm is required: ISO-8859-1
t/new.........ok
t/rdf.........ok
t/round.......ok
t/rss.........ok
All tests successful, 1 subtest skipped.
Files=7, Tests=170,  1 wallclock secs ( 0.65 cusr +  0.14 csys =  0.79 CPU)
$ sudo make install

Comments by AjaxCom

Links

Kawa.netxp © Copyright 2006-2011 Yusuke Kawasaki