Skip Menu |
 

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

Report information
The Basics
Id: 2346
Status: new
Priority: 0/
Queue: XML-NamespaceSupport

People
Owner: Nobody in particular
Requestors: dom [...] happygiraffe.net
Cc:
AdminCc:

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

Attachments


Subject: Fatal error in get_declared_prefixes()
Download (untitled) / with headers
text/plain 559b
I've just tried calling $nsup->get_declared_prefixes(). Alas, no prefixes had been declared, so I was greeted with an exception: Can't use an undefined value as an ARRAY reference at /usr/local/lib/perl5/site_perl/5.8.0/XML/NamespaceSupport.pm line 192. I fixed it by adding the attached patch. It seems right; if no new prefixes are present, then an empty list should be returned. I'm not sure about the other accesses of $self->[NSMAP]->[-1]->[DECLARATIONS] in the same file; they may well need similiar attention. Many thanks for your attention, -Dom
--- /usr/local/lib/perl5/site_perl/5.8.0/XML/NamespaceSupport.pm.orig Sat Apr 5 15:58:26 2003 +++ /usr/local/lib/perl5/site_perl/5.8.0/XML/NamespaceSupport.pm Sat Apr 5 15:58:48 2003 @@ -189,7 +189,7 @@ # get_declared_prefixes() - get all prefixes declared in the last context #-------------------------------------------------------------------# sub get_declared_prefixes { - return @{$_[0]->[NSMAP]->[-1]->[DECLARATIONS]}; + return @{$_[0]->[NSMAP]->[-1]->[DECLARATIONS]||[]}; } #-------------------------------------------------------------------#
Date: Sat, 5 Apr 2003 17:22:23 +0100
To: XML-NamespaceSupport <bug-XML-NamespaceSupport [...] rt.cpan.org>
Subject: Re: [cpan #2346] AutoReply: Fatal error in get_declared_prefixes()
From: dom [...] happygiraffe.net (Dominic Mitchell)
RT-Send-Cc:
Download (untitled) / with headers
text/plain 749b
On Sat, Apr 05, 2003 at 10:05:12AM -0500, XML-NamespaceSupport wrote: Show quoted text
> I've just tried calling $nsup->get_declared_prefixes(). Alas, no > prefixes had been declared, so I was greeted with an exception: > > Can't use an undefined value as an ARRAY reference at /usr/local/lib/perl5/site_perl/5.8.0/XML/NamespaceSupport.pm line 192. > > I fixed it by adding the attached patch. It seems right; if no new > prefixes are present, then an empty list should be returned. I'm not > sure about the other accesses of $self->[NSMAP]->[-1]->[DECLARATIONS] > in the same file; they may well need similiar attention.
Doh. I've just realised that this was because I hadn't called push_context() yet. Maybe this should be noted in the docs? Thanks, -Dom
Date: Sun, 06 Apr 2003 15:15:45 +0200
From: Robin Berjon <robin.berjon [...] expway.fr>
To: bug-XML-NamespaceSupport [...] rt.cpan.org
CC: dom [...] happygiraffe.net
Subject: Re: [cpan #2346] AutoReply: Fatal error in get_declared_prefixes()
RT-Send-Cc:
dom@happygiraffe.net via RT wrote: Show quoted text
>>I've just tried calling $nsup->get_declared_prefixes(). Alas, no >>prefixes had been declared, so I was greeted with an exception: >> >>Can't use an undefined value as an ARRAY reference at /usr/local/lib/perl5/site_perl/5.8.0/XML/NamespaceSupport.pm line 192. >> >>I fixed it by adding the attached patch. It seems right; if no new >>prefixes are present, then an empty list should be returned. I'm not >>sure about the other accesses of $self->[NSMAP]->[-1]->[DECLARATIONS] >>in the same file; they may well need similiar attention.
> > Doh. I've just realised that this was because I hadn't called > push_context() yet. Maybe this should be noted in the docs?
Ah yes, that would normally cause some trouble :) I'll add something to the docs, and come up with a patch resembling yours that would tell you you haven't called push_context(). It's a user bug but the module should clearly be more informative :) Thanks! -- Robin Berjon <robin.berjon@expway.fr> Research Engineer, Expway http://expway.fr/ 7FC0 6F5F D864 EFB8 08CE 8E74 58E6 D5DB 4889 2488


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.