Patch to XML::RSS::SimpleGen for pubDate (was Re: Inkscape RSS)
Hi Sean,
The attach patch adds pubDate to XML::RSS::SimpleGen.
Bryce
On Thu, Sep 01, 2005 at 11:08:28AM +0300, Nicu Buculei wrote:
--- SimpleGen.pm.orig 2005-09-11 21:46:00.000000000 -0700 +++ SimpleGen.pm 2005-09-11 22:11:12.000000000 -0700 @@ -320,11 +320,15 @@
=item C<rss_item( I<url, title, description> );>
+=item C<rss_item( I<url, title, description, pubDate> );> + This adds a new item to the current feed. You will need to specify the URL to add (and it should be a valid-looking URL, starting with "Isomething:", and not containing any spaces). You may also specify -the title, but it's optional. And finally, you can optionally specify a -description. (You can remember this because it starts with the essential +the title, description, and published date, but those are all +optional. (You can remember this because it starts with the essential item first, and progresses toward the most optional.)
Leading and tailing whitespace is removed from whichever of I<url, @@ -354,7 +358,7 @@
=cut
-sub item { # Add an item: (url, title, description) +sub item { # Add an item: (url, title, description, [pubDate]) my($self, @params) = @_; if( grep defined($_) && length($_), @params ) { push @{$self->{'items'}}, @@ -703,13 +707,13 @@
sub _process_item_params { my $self = shift; - my($url, $title, $description) = + my($url, $title, $description, $pubDate) = map {; (defined($_) && m/\S/) ? $_ : '' } # contentfulness filter map $self->html2text($_), # here's where we de-htmlify things @_; ; - - for($url, $title, $description) { + + for($url, $title, $description, $pubDate) { if(ref $_ ) { } # Okay elsif(defined $_) { s/^\s+//s; s/\s+$//s } else { $_ = '' } @@ -730,7 +734,7 @@ ); } } - return ($url, $title, $description); + return ($url, $title, $description, $pubDate); }
#.......................................................................... @@ -771,13 +775,14 @@ DEBUG and print scalar(@items), " items at hand:\n";
foreach my $i (@items) { - my($url, $title, $description) = @$i; + my($url, $title, $description, $pubDate) = @$i; DEBUG > 1 and print "I: (u $url) (t $title) (d $description)\n"; next unless $url or $title or $description; push @xml_out, "<item>$MaybeNL", (map "$MaybeIndent$_$MaybeNL", length($title) ? "<title>$title</title>" : (), + length($pubDate) ? "<pubDate>$pubDate</pubDate>" : (), length($url) ? "<link>$url</link>" : (), length($description) ? "<description>$description</description>" : (), ),
participants (1)
-
Bryce Harrington