User: gaute Date: 2007/04/25 02:01:16 Modified: no/www/rss.pl
Log: code cleanup File Changes: Directory: /no/www/ =================== File [changed]: rss.pl Url: http://no.openoffice.org/source/browse/no/www/rss.pl?r1=1.6&r2=1.7 Delta lines: +7 -15 -------------------- --- rss.pl 25 Apr 2007 08:51:39 -0000 1.6 +++ rss.pl 25 Apr 2007 09:01:13 -0000 1.7 @@ -1,6 +1,6 @@ #!/usr/bin/perl -# $Id: rss.pl,v 1.6 2007/04/25 08:51:39 gaute Exp $ +# $Id: rss.pl,v 1.7 2007/04/25 09:01:13 gaute Exp $ # # Generates an RSS feed from the news on our front page. # @@ -44,10 +44,8 @@ use utf8; use Encode qw(decode); -use Date::Manip qw(ParseDate UnixDate); use POSIX qw(mktime strftime setlocale); use XML::RSS; -use HTML::FormatText 2; my $CHANNEL_TITLE = "OpenOffice.org på norsk"; my $CHANNEL_LINK = "http://no.openoffice.org/"; @@ -62,8 +60,8 @@ undef $/; my $html = <>; -my $rss = XML::RSS->new (version => '2.0'); -$rss->channel( title => $CHANNEL_TITLE, +my $rss = XML::RSS->new(version => '2.0'); +$rss->channel(title => $CHANNEL_TITLE, link => $CHANNEL_LINK, description => $CHANNEL_DESC, language => $CHANNEL_LANG); @@ -85,21 +83,15 @@ </div>}gxs) { my $title = decode("utf8", $1); my $day = $2; - my $month = $3 - 1; # subtract 1 to make strftime happy - my $year = $4 - 1900; # subtract 1900 for strftime's sake + my $month = $3 - 1; + my $year = $4 - 1900; my $description = decode("utf8", $5); -# $description = Encode::decode("utf8", $description); - # Craft a guid from title and date. my $guid = "$title $year-$month-$day"; my $date = strftime($rfc822_fmt, localtime(mktime(0, 0, 0, $day, $month, $year))); - - # Strip HTML tags. Perl Cookbook 20.6.2. - # ... but HTML tags seem to be allowed and seem to work. -# $description = HTML::FormatText->format_string($description); $rss->add_item(title => $title, link => $CHANNEL_LINK, # We have no separate news --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
