#! /usr/bin/perl use XML::RSS; print "Content-type: text/html\n\n"; # URL to the RSS feed $url = "http://www.microsite.reuters.com/rss/scienceNews"; # file to write the feed to # apache needs to have write access to this file $file = "./reuters.rdf"; # get the feed `GET '$url' > $file`; # create new instance of XML::RSS my $rss = new XML::RSS; eval {$rss->parsefile("$file");}; if ($@) {die "Error parsing $file.\n$@\n";} # set up the title $title = "$rss->{'channel'}->{'title'}"; # print the channel items foreach my $item (@{$rss->{'items'}}) { next unless defined($item->{'title'}) && defined($item->{'link'}); my $trans_link = $item->{'link'}; $trans_link =~ s/%26/&/g; push(@body, "
  • $item->{'title'}
    "); } # if there's a textinput element if ($rss->{'textinput'}->{'title'}) { push(@body, "
    {'textinput'}->{'link'}\">"); push(@body, "$rss->{'textinput'}->{'description'}
    "); push(@body, "{'textinput'}->{'name'}\">
    "); push(@body, "{'textinput'}->{'title'}\">
    "); } # if there's a copyright element if ($rss->{'channel'}->{'copyright'}) { push(@body, "
    $rss->{'channel'}->{'copyright'}"); } $body = join("\n", @body); # print out the block print << "E_O_F";
    $title
    $body
    E_O_F exit;