#!/usr/bin/perl --
use strict;
use warnings;
use XML::Twig;
use LWP::Simple qw( $ua );
$ua->agent('Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)');
my $url = 'http://search.cpan.org/uploads.rdf';
my $twig = XML::Twig->nparse_pp(
TwigRoots => {
'item/title' => sub{},
},
$url
);
$twig->print;
__END__
and example output
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns="http://purl.org/rss/1.0/" xmlns:admin="http://webns.ne
+t/mvcb/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xml
+ns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org
+/1999/02/22-rdf-syntax-ns#" xmlns:syn="http://purl.org/rss/1.0/module
+s/syndication/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/
+">
<title>Pod-Markdown-0.01</title>
<title>WWW-Nike-NikePlus-0.03</title>
<title>Coro-5.2</title>
<title>App-War-0.01</title>
<title>JavaScript-Packer-0.03_01</title>
<title>File-Path-2.08</title>
<title>Task-BeLike-hanekomu-0.01</title>
</rdf:RDF>
|