%# If this fortune didn't exist, somebody would have invented it.
<table border="0" cellspacing="1" cellpadding="2" width=100%>
<tr><td class="tableTitle">
<table border="0" cellspacing="0" cellpadding="0" width=100%>
<tr><td width="36">&nbsp;</td>
<td align="center"><% $Title %></td>
<td width="36"><a href="<% $URL %>"><img alt="RSS" title="<&|/l&>RSS Feed</&>" src="/Foundry/Icons/rss.png" border="0" align="right"></a></td></tr>
</table></td></tr>
% eval { $rss->parsefile($file) };
% if ($@)
% { unlink $file; 
% }
% else{
%   my $count = 0;
%   foreach my $item (@{ $rss->items })
%   { last if $count++ == $Limit;
        <tr bgcolor="white"><td><nobr>
        <a href="<% $item->{link} %>"><% $item->{title} %></a>
        <img src="/Foundry/Icons/external-classic.png">
        </nobr></td></tr>
%   }
% }
%# XXX Correctly link to a real "More" page.
<!--
<tr style="background: transparent"><td align="right"><em><a href="<% $URL %>"><&|/l&>More</&>...</a></em></td></tr>
-->
</table>
<%ONCE>
require LWP::UserAgent;
my $ua = new LWP::UserAgent;  # we create a global UserAgent object
$ua->agent("OpenFoundry Bot");
require XML::RSS;
my $rss = XML::RSS->new;
</%ONCE>
<%INIT>
%::escapes = map { chr($_) => sprintf("%%%02X", $_) } 0..255 unless %::escapes;

my $file = $URL;
$file =~ s/([^\w\.])/$::escapes{$1}/g;
$file = File::Spec->catfile( ($ENV{TEMP} || '/tmp'), $file);
$ua->timeout($Timeout);
$ua->mirror( $URL, $file );
# Don't care HTTP success or fail , let $rss handle it
</%INIT>
<%ARGS>
$URL => 'http://www.openfoundry.org/index.rdf'
$Timeout => 1
$Title => '...'
$Limit => 7
</%ARGS>
