Skip Menu |

This queue is for tickets about the XML-RSS CPAN distribution.

Report information
The Basics
Id: 29168
Status: rejected
Worked: 20 min
Priority: 0/
Queue: XML-RSS

People
Owner: SHLOMIF [...] cpan.org
Requestors: dan2bit [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: XML::RSS::Private::Output::Base::_encode confesses too much
Date: Tue, 4 Sep 2007 13:32:45 -0400
To: bug-XML-RSS [...] rt.cpan.org
From: "Dan Rinzel" <dan2bit [...] gmail.com>
XML::RSS::Private::Output::Base::_encode's confess is being tripped by the following script in 1.31, which worked fine under previous versions of XML::RSS - it does not matter what value $spin gets. I also tried patching my script by adding an empty description => " " for my item, and by using $single->{output} = "0.9"; to no avail. I ended up patching _encode to just return; instead of confessing, which restored the functionality to the script, but seems like there should be a better way. Thanks for the work on the module though, it is great! -dan2bit use XML::RSS; while (<DATA>) { next unless /^(\d+)\.\s+/; $num = $1; chomp; s/^\d+\.\s+//; $rules{$num} = $_; } print "Content-type:text/xml \n\n"; my @spin = (1..$num); my $spin = $spin[rand $#spin]; my $rule = $rules{$spin}; my $single = new XML::RSS (version => '0.9'); $single->channel( title => "Evil Overlord Rule $spin", link => 'http://www.eviloverlord.com', ); my %item = ( title => $rule, ); $single->add_item(%item); print $single->as_string; __END__ 1. My Legions of Terror will have helmets with clear plexiglass visors, not face-concealing ones. .... more data here ....
Hi Dan! Thanks for the test case. On Tue Sep 04 13:33:35 2007, dan2bit@gmail.com wrote: Show quoted text
> XML::RSS::Private::Output::Base::_encode's confess is being tripped
by Show quoted text
> the following script in 1.31, which worked fine under previous > versions of XML::RSS - it does not matter what value $spin gets. I > also tried patching my script by adding an empty > description => " " > for my item, and by using > $single->{output} = "0.9"; > > to no avail. I ended up patching _encode to just return; instead of > confessing, which restored the functionality to the script, but
seems Show quoted text
> like there should be a better way. >
Quoting from the confess: {{{{{{{{{{{{{{{ XML::RSS::Private::Output::Base::_out_tag('XML::RSS::Private::Output::V0_9=HASH(0x8359d24)', 'link', 'undef') called at /usr/lib/perl5/vendor_perl/5.8.8/XML/RSS/Private/Output/Base.pm line 123 }}}}}}}}}}}}}}} So you need to define the "link" field of the item. The attached script, to which I only added one line, works perfectly. It is possible that a less obscure error is required here, but in any case, it seems that you need to add a "link" to the item. Show quoted text
> Thanks for the work on the module though, it is great! >
On behalf of Ask, me and other contributors - thanks! Show quoted text
> -dan2bit >
Regards, Shlomi Fish Show quoted text
> use XML::RSS; > > while (<DATA>) { > next unless /^(\d+)\.\s+/; > $num = $1; > chomp; > s/^\d+\.\s+//; > $rules{$num} = $_; > } > > print "Content-type:text/xml \n\n"; > my @spin = (1..$num); > my $spin = $spin[rand $#spin]; > my $rule = $rules{$spin}; > my $single = new XML::RSS (version => '0.9'); > $single->channel( > title => "Evil Overlord Rule $spin", > link => 'http://www.eviloverlord.com', > ); > my %item = ( > title => $rule, > ); > > $single->add_item(%item); > print $single->as_string; > > > > > __END__ > 1. My Legions of Terror will have helmets with clear plexiglass > visors, not face-concealing ones. > .... more data here ....
use XML::RSS; while (<DATA>) { next unless /^(\d+)\.\s+/; $num = $1; chomp; s/^\d+\.\s+//; $rules{$num} = $_; } print "Content-type:text/xml \n\n"; my @spin = (1..$num); my $spin = $spin[rand $#spin]; my $rule = $rules{$spin}; my $single = new XML::RSS (version => '0.9'); $single->channel( title => "Evil Overlord Rule $spin", link => 'http://www.eviloverlord.com', ); my %item = ( title => $rule, link => "Hello", ); $single->add_item(%item); print $single->as_string; __END__ 1. My Legions of Terror will have helmets with clear plexiglass visors, not face-concealing ones. .... more data here ....
I explained what's the problem with the aforementioned script and the original poster hasn't responded. The behaviour is expected given the circumstances of a missing field so this should no longer bother us. Regards, Shlomi Fish