<%perl> $sth->execute($site); $content = $sth->fetch->[0]; # parse the RSS content $rss->parse($content);
<% $rss->{'channel'}->{'title'} %>
% # print channel image % if ($rss->{'image'}->{'link'}) { <% $rss->{'image'}->{'title'} %>{'image'}->{'width'}){ width="<% $rss->{'image'}->{'width'} %>" % } % if($rss->{'image'}->{'height'}){ height="<% $rss->{'image'}->{'height'} %>" % } > % }

% # print the channel items % foreach my $item (@{$rss->{'items'}}) { % next unless defined($item->{'title'}) && defined($item->{'link'});

  • <% $item->{'title'} %>
    % } % # if there's a textinput element % if ($rss->{'textinput'}->{'title'}) {
    <% $rss->{'textinput'}->{'description'} %>

    % } % # if there's a copyright element % if ($rss->{'channel'}->{'copyright'}) {

    <% $rss->{'channel'}->{'copyright'} %>

    % }
  • <%args> $site <%once> my $dbh; $dbh = DBI->connect("DBI:mysql:book","root","c600go") || die "Cannot connect: $DBI::errstr\n" unless $dbh; my $sth = $dbh->prepare(qq{SELECT data FROM rss WHERE site = ?}); <%init> my $content; my $file; my $rss; $rss = new XML::RSS;