Warning: These wiki pages have not been edited in years and may well be out of date/inaccurate. We recommend that you use them as a starting point for further investigation, rather than gospel.
<& template:top, qq|<a href="$rss->{'channel'}->{'link'}">$rss->{'channel'}->{'title'}</a>| &>
% # Output channel image if it exists
% if ($rss->{'image'}->{'link'} && $rss->{'image'}->{'url'}) {
<a href="<%$rss->{'image'}->{'link'}%>"><img src="<%$rss->{'image'}->{'url'}%>" alt="<%$rss->{'image'}->{'title'}%>" border="0" <%$rss->{'image'}->{'width'} ? qq|width="$rss->{'image'}->{'width'}"| : ''%> <%$rss->{'image'}->{'height'} ? qq|height="$rss->{'image'}->{'height'}"| : ''%>></a>
% }
<p />
% # Output channel items
% foreach my $item (@{$rss->{'items'}}) {
% next unless defined($item->{'title'}) && defined($item->{'link'});
<li><a class="nav" href="<%$item->{'link'}%>"><%$item->{'title'}%></a></li>
% }
<p />
% # Output textinput element if it exists
% if ($rss->{'textinput'}->{'title'}) {
<form method="get" action="<%$rss->{'textinput'}->{'link'}%>">
<span class="title"><% $rss->{'textinput'}->{'description'} %></span><br />
<input type="text" name="<%$rss->{'textinput'}->{'name'}%>"><br />
<input type="submit" value="<%$rss->{'textinput'}->{'title'}%>">
% }
% # Output copyright element if it exists
% if ($rss->{'channel'}->{'copyright'}) {
<p /><sub><%$rss->{'channel'}->{'copyright'}%></sub>
% }
<& template:bottom &>
use XML::RSS;
use LWP::Simple;
my $rss = new XML::RSS;
my $content = $m->cache->get($src);
# my $content = $m->cache(action=>'retrieve', key=>$src);
# This syntax didn't work for me, but $m->cache->get($src) did.

if (! defined $content) {
$content = get($src);
die "Could not retrieve $src" unless $content;
$m->cache->set($src => $content, '1 hour');
# $m->cache(action=>'store', key=>$src, expire_in=>'1 hour', value=>$content);
# Similar to above - I don't know if this is an older/different interface to the cache or what...


A 'portlet' like component for fetching and displaying RSS syndicated content.


.01 - First release.


- Easy to incorporate into any Mason server.
- Low dependancies. Only needs XML::RSS and LWP::Simple.
- Uses Mason caching to avoid overloading RSS servers.


- Drop rss component into

- Define a 'template' to wrap the portlet. A template is a Mason component with 'top' and 'bottom' methods.
These methods should describe a nice table for the content. 'top' method should take a title as first arg.
Alternatively, you can put the wrapper HTML in the rss component.

- Call rss in your autohandler or HTML page like so <& '/portlets/rss', src=>'' &>
Assumes rss component is in "portlets" directory.

- Note that XML::RSS (and all other modules build on XML::Parse) are incompatible with the standard expat built
in to Apache. You'll need to compile Apache without expat in order to have this work. If you try to use this
and get segfaults from Apache, that's probably the cause.


Jonathan Swartz made HTML::Mason.
Jonathan Eisenzopf made the XML::RSS package and upon which the rss component is based.
"Dennis Watson" <> combined the two into this package.
Rick Ford made some minor edits & comments


The rss component is free software.
It is distributable under the same terms as HTML::Mason itself.