The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

CGI::RSS - provides a CGI-like interface for making rss feeds

SYNOPSIS

    use strict;
    use CGI::RSS;

    # NOTE: This doesn't work either way like CGI.pm, it's only OO...

    my $rss = new CGI::RSS;

    print $rss->header;
    print $rss->begin_rss(
        title => "My Feed!",
        link  => "http://localhost/directory",
        desc  => "My feed is cool!");

    while( my $h = $sth->fetchrow_hashref ) {
        print $rss->item(
            $rss->title       ( $h->{title} ),
            $rss->link        ( $h->{link}  ),
            $rss->guid        ( $h->{link}  ), # unique identifier, usually
            $rss->description ( $h->{desc}  ), #   a permalink
            $rss->date        ( $h->{date}  ), # does rfc822 date processing
        );
    }
    print $rss->finish_rss;

TAGS

RSS TAGS

The following tags work anywhere. There is no enforcement for where they belong. They're just tag functions.

    rss channel item title link description language copyright
    managingEditor webMaster pubDate lastBuildDate category
    generator docs cloud ttl image rating textInput skipHours
    skipDays link description author category comments enclosure
    guid pubDate source date url

MORE TAGS

RSS.pm tricks CGI.pm into thinking the above tags are are valid html tags. It does this at run time so you can add your own.

    push @CGI::RSS::TAGS, "mytagname";

The construction of CGI.pm's _make_tag_func() rule's out namespaces (e.g., push @CGI::RSS::TAGS, "myns:mytag"), if you have any suggestions on how to handle this, please let me know.

I had considered writing a CGI::RSS::_make_tag_func() that converts the ':' to a '_' in the function name... That's harder than it sounds so I let it go for now.

pubDate Format

The pubDate field is parsed and forced into a standard format. This format has caused problems for some people in the past. The default format is “%a, %d %b %Y %H:%M:%S %Z”.

The format can be changed via accessor or via namespace variable. The following are all equivalent.

  $CGI::RSS::pubDate_format = "%a, %d %b %Y %H:%M:%S %z";
  $CGI::RSS->pubDate_format("%a, %d %b %Y %H:%M:%S %z");
  $cgi->pubDate_format("%a, %d %b %Y %H:%M:%S %z");

TODO

I just wanted to get this thing working for now, but I'm not proud of the module. In the future, I'd like to actually follow a standard.

 1. conform to standard(s) if possible
 2. deal with xmlns somehow

AUTHOR

Paul Miller <jettero@cpan.org>

I am using this software in my own projects... If you find bugs, please please please let me know. :) Actually, let me know if you find it handy at all. Half the fun of releasing this stuff is knowing that people use it.

COPYRIGHT

Copyright (c) 2009 Paul Miller -- LGPL

SEE ALSO

CGI

1 POD Error

The following errors were encountered while parsing the POD:

Around line 63:

Non-ASCII character seen before =encoding in '“C<%a,'. Assuming UTF-8