Subject: | Fatal error in get_declared_prefixes() |
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]||[]};
}
#-------------------------------------------------------------------#