Perlで書いたRSS Readerのスクリプト例です。この例ではasahi.comのrss/index.rdfを読み込み表示しています。 sample
#!/usr/local/bin/perl
use LWP::Simple 'get';
use XML::RSS;
use Jcode;
my $URL = 'http://www3.asahi.com/rss/index.rdf';
my $rss = new XML::RSS;
eval {
$rss->parse(get($URL));
};
print qq|Content-Type: text/html\n\n|;
print qq|<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
</head>\n|;
print qq|<body>Perlで書いたRSS Readerの例です。<br>
この例ではasahi.comのrss/index.rdfを読み込み表示しています。<ul>\n|;
for my $item (@{$rss->{items}}) {
printf qq|<li><a href="%s">%s</a><br>\n|, $item->{link}, Jcode::convert(\$item->{title}, sjis);
}
print qq|</ul></body></html>\n|;
use LWP::Simple 'get';
use XML::RSS;
use Jcode;
my $URL = 'http://www3.asahi.com/rss/index.rdf';
my $rss = new XML::RSS;
eval {
$rss->parse(get($URL));
};
print qq|Content-Type: text/html\n\n|;
print qq|<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
</head>\n|;
print qq|<body>Perlで書いたRSS Readerの例です。<br>
この例ではasahi.comのrss/index.rdfを読み込み表示しています。<ul>\n|;
for my $item (@{$rss->{items}}) {
printf qq|<li><a href="%s">%s</a><br>\n|, $item->{link}, Jcode::convert(\$item->{title}, sjis);
}
print qq|</ul></body></html>\n|;