#!/usr/bin/perl -w use strict; use LWP::Simple; use XML::RSS; my @files = qw( http://use.perl.org/useperl.rss http://search.cpan.org/rss/search.rss http://jobs.perl.org/rss/standard.rss http://www.perl.com/pace/perlnews.rdf http://www.perlfoundation.org/perl-foundation.rdf http://www.stonehenge.com/merlyn/UnixReview/ur.rss http://www.stonehenge.com/merlyn/WebTechniques/wt.rss http://www.stonehenge.com/merlyn/LinuxMag/lm.rss ); my $base = '/usr/home/comdog/TPR/rss-html'; foreach my $url ( @files ) { my $file = $url; $file = s|.*/||; my $result = open my $fh, "> $base/$file.html"; unless( $result ) { warn "Could not open [$file] for writing! $!"; next; } select $fh; my $rss = XML::RSS->new(); my $data = get( $url ); $rss->parse( $data ); my $channel = $rss->{channel}; my $image = $rss->{image}; print <<"HTML";
HTML if( $image->{url} ) { my $img = qq|$$channel{title}|; print qq|$img
\n|. } else { print qq|$$channel{title}
\n|. } print qq|$$channel{description}\n|; print <<"HTML";
HTML foreach my $item ( @{ $rss->{items} } ) { print qq|>$$item{title}

\n|; } print <<"HTML";
HTML close $fh; }