#!/usr/bin/perl -w # Perl cgi that will get the Atom feed from a site (blogger) # and display the title and links. Suitable for a simple # RSS box on a website. # # Creator: Stephen K. Anthony (http://stephenanthony.ca) # Date: December 19, 2004 # ADDITIONS for new blogger by brian greene (http://www.briangreene.com) # Date: Jan/Feb, 2007 # # Note: Would have used XML::Atom would they have worked with ActivePerl. # This script is a little less useful, and a little more cumbersome as a result. use LWP::Simple; use LWP::UserAgent; use CGI qw(:standard); use CGI::Carp qw(warningsToBrowser fatalsToBrowser); use strict; my($ua) = LWP::UserAgent->new; # Accessing Atom feed my($req) = HTTP::Request->new(GET => 'http://www.YOUR-DOMAIN.ie/atom.xml'); my($res) = $ua->request($req); print header; #print start_html("Blogger Feed"); my $xml = $res->content; my $line=1; =for # use the block for old blogger # by removing the for-cut and comment out new blogger block while( $xml =~ m/"; } if($line gt 0){print "
"; }
print "";
print "$3
";
if($line gt 0){print "<\/p>"; }
$line++;
}
}
=cut
# use the block for NEW blogger
while($xml =~ m/
"; }
print "";
print "$1
";
if($line gt 0){print "<\/p>"; }
$line++;
}
}
print "<\/ul>";
print end_html;