Skip Menu |

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

Report information
The Basics
Id: 7324
Status: resolved
Priority: 0/
Queue: XML-RSS

People
Owner: ABH [...] cpan.org
Requestors: rajit [...] yahoo-inc.com
Cc:
AdminCc:

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



Subject: Can't ->parsefile; the .rss from http://www.t3.co.uk/rss/
XML-RSS-1.04, perl 5.6.1, FreeBSD 4.10 Using rss.pl as follows <<__END__; use XML::RSS; my $rss = new XML::RSS; $rss->parsefile("<downloaded .rss from http://www.t3.co.uk/rss/>"); __END__ Running this gives the error: Use of uninitialized value in string eq at /home/y/lib/perl5/site_perl/5.6.1/XML/RSS.pm line 1483. Use of uninitialized value in string eq at /home/y/lib/perl5/site_perl/5.6.1/XML/RSS.pm line 1348. Modification of non-creatable array value attempted, subscript -1 at /home/y/lib/perl5/site_perl/5.6.1/XML/RSS.pm line 1355. I've attached a patch that I created for RSS.pm that lets it parse the rss from t3.co.uk without a hitch. The problem seems to be '(!$ns && !$self->{rss_namespace})'. I made it just '!$ns' in all situations because I don't understand why we would expect $self->{rss_namespace} not to be defined. If someone is using rss as their default namespace, then that element _will_ be defined as per line 1456, but we might be inside an 'item' without a namespace since xmlns= might be set to rss. Hmm... maybe it's meant to read (!$ns && $self->{rss_namespace}) ?? I guess ideally you want to set $self->{default_namespace} then you could do (!$ns && $self->{default_namespace} eq 'rss') or something along those lines. Maybe the intention was to cater for not having rss defined by some lazy rss generator, in which case the following clause might work: !$self->{default_namespace} || (!$ns && $self->{default_namespace} eq 'rss') || ... Would much appreciate it if I could find out when the package has either been updated with the patch, or with a more appropriate fix. Cheers!
--- RSS.pm Wed Aug 11 16:41:07 2004 +++ /home/y/lib/perl5/site_perl/5.6.1/XML/RSS.pm Wed Aug 11 16:56:14 2004 @@ -1320,7 +1320,7 @@ my $ns = $self->namespace($self->current_element); # If it's in the default namespace if ( - (!$ns && !$self->{rss_namespace}) || + !$ns || ($ns eq $self->{rss_namespace}) ) { $self->{'image'}->{$self->current_element} .= $cdata; @@ -1346,7 +1346,7 @@ # If it's in the default RSS 1.0 namespace if ( - (!$ns && !$self->{rss_namespace}) || + !$ns || ($ns eq $self->{rss_namespace}) ) { $self->{'items'}->[$self->{num_items}-1]->{$self->current_element} .= $cdata; @@ -1368,7 +1368,7 @@ # If it's in the default namespace if ( - (!$ns && !$self->{rss_namespace}) || + !$ns || ($ns eq $self->{rss_namespace}) ) { $self->{'textinput'}->{$self->current_element} .= $cdata; @@ -1406,7 +1406,7 @@ # If it's in the default namespace if ( - (!$ns && !$self->{rss_namespace}) || + !$ns || ($ns eq $self->{rss_namespace}) ) { $self->{'channel'}->{$self->current_element} .= $cdata; @@ -1481,7 +1481,7 @@ my $ns = $self->namespace( $el ); if ( - (!$ns && !$self->{rss_namespace}) || + !$ns || ($ns eq $self->{rss_namespace}) ) { # increment item count
On Wed Aug 11 12:15:02 2004, guest wrote: Show quoted text
> XML-RSS-1.04, perl 5.6.1, FreeBSD 4.10 > > Using rss.pl as follows <<__END__; > use XML::RSS; > my $rss = new XML::RSS; > $rss->parsefile("<downloaded .rss from http://www.t3.co.uk/rss/>");
Hi Rajit, Any chance you can create a test case for this we can include in the distribution? :-) - ask
From: SHLOMIF [...] cpan.org
On Wed Aug 11 12:15:02 2004, guest wrote: Show quoted text
> XML-RSS-1.04, perl 5.6.1, FreeBSD 4.10 > > Using rss.pl as follows <<__END__; > use XML::RSS; > my $rss = new XML::RSS; > $rss->parsefile("<downloaded .rss from http://www.t3.co.uk/rss/>"); > __END__ > > Running this gives the error: > Use of uninitialized value in string eq at > /home/y/lib/perl5/site_perl/5.6.1/XML/RSS.pm line 1483. > Use of uninitialized value in string eq at > /home/y/lib/perl5/site_perl/5.6.1/XML/RSS.pm line 1348. > Modification of non-creatable array value attempted, subscript -1 at > /home/y/lib/perl5/site_perl/5.6.1/XML/RSS.pm line 1355. > > I've attached a patch that I created for RSS.pm that lets it parse
the Show quoted text
> rss from t3.co.uk without a hitch. The problem seems to be '(!
$ns Show quoted text
> && !$self->{rss_namespace})'. I made it just '!$ns' in all > situations because I don't understand why we would expect $self-
> >{rss_namespace} not to be defined. If someone is using rss as
> their default namespace, then that element _will_ be defined as
per Show quoted text
> line 1456, but we might be inside an 'item' without a namespace > since xmlns= might be set to rss. > > Hmm... maybe it's meant to read (!$ns && $self->{rss_namespace}) ??
I Show quoted text
> guess ideally you want to set $self->{default_namespace} then you > could do (!$ns && $self->{default_namespace} eq 'rss') or
something Show quoted text
> along those lines. Maybe the intention was to cater for not
having Show quoted text
> rss defined by some lazy rss generator, in which case the
following Show quoted text
> clause might work: > !$self->{default_namespace} || (!$ns && $self->{default_namespace}
eq Show quoted text
> 'rss') || ... > > Would much appreciate it if I could find out when the package has > either been updated with the patch, or with a more appropriate
fix. Show quoted text
>
Hi! I tried it on the current version of the RSS feed, and it works fine: <<<<<< $ perl -w -Mstrict -MXML::RSS -e 'my $rss=XML::RSS->new(); $rss->parsefile(shift(@ARGV))' www.t3.co.uk.rss Show quoted text
>>>>>>
I guess the RSS feed was changed. Do you have a different RSS feed that reproduces this problem (or can create one?). If not, I suggest closing this bug. Regards, Shlomi Fish
Subject: RE: [rt.cpan.org #7324] Can't ->parsefile; the .rss from http://www.t3.co.uk/rss/
Date: Fri, 20 Oct 2006 12:23:54 +0100
To: <bug-XML-RSS [...] rt.cpan.org>
From: <rajit [...] yahoo-inc.com>
Unfortunately forgotten my login details - can anyone else close the bug? Rajit Show quoted text
-----Original Message----- From: Shlomi Fish via RT [mailto:bug-XML-RSS@rt.cpan.org] Sent: 20 October 2006 12:02 To: rajit@yahoo-inc.com Subject: [rt.cpan.org #7324] Can't ->parsefile; the .rss from http://www.t3.co.uk/rss/ <URL: http://rt.cpan.org/Ticket/Display.html?id=7324 > On Wed Aug 11 12:15:02 2004, guest wrote:
> XML-RSS-1.04, perl 5.6.1, FreeBSD 4.10 > > Using rss.pl as follows <<__END__; > use XML::RSS; > my $rss = new XML::RSS; > $rss->parsefile("<downloaded .rss from http://www.t3.co.uk/rss/>"); > __END__ > > Running this gives the error: > Use of uninitialized value in string eq at > /home/y/lib/perl5/site_perl/5.6.1/XML/RSS.pm line 1483. > Use of uninitialized value in string eq at > /home/y/lib/perl5/site_perl/5.6.1/XML/RSS.pm line 1348. > Modification of non-creatable array value attempted, subscript -1 at > /home/y/lib/perl5/site_perl/5.6.1/XML/RSS.pm line 1355. > > I've attached a patch that I created for RSS.pm that lets it parse
the
> rss from t3.co.uk without a hitch. The problem seems to be '(!
$ns
> && !$self->{rss_namespace})'. I made it just '!$ns' in all > situations because I don't understand why we would expect $self-
> >{rss_namespace} not to be defined. If someone is using rss as
> their default namespace, then that element _will_ be defined as
per
> line 1456, but we might be inside an 'item' without a namespace > since xmlns= might be set to rss. > > Hmm... maybe it's meant to read (!$ns && $self->{rss_namespace}) ??
I
> guess ideally you want to set $self->{default_namespace} then you > could do (!$ns && $self->{default_namespace} eq 'rss') or
something
> along those lines. Maybe the intention was to cater for not
having
> rss defined by some lazy rss generator, in which case the
following
> clause might work: > !$self->{default_namespace} || (!$ns && $self->{default_namespace}
eq
> 'rss') || ... > > Would much appreciate it if I could find out when the package has > either been updated with the patch, or with a more appropriate
fix.
>
Hi! I tried it on the current version of the RSS feed, and it works fine: <<<<<< $ perl -w -Mstrict -MXML::RSS -e 'my $rss=XML::RSS->new(); $rss->parsefile(shift(@ARGV))' www.t3.co.uk.rss
>>>>>>
I guess the RSS feed was changed. Do you have a different RSS feed that reproduces this problem (or can create one?). If not, I suggest closing this bug. Regards, Shlomi Fish