Subject: | undeclare_prefix bug as i think (not tested) |
XML-NamespaceSupport v1.09
I researched sources you XML::NamespaceSupport 1.09 version and found
interesting place. I think there is bug.
The chunk from code:
sub undeclare_prefix {
my $self = shift;
my $prefix = shift;
return unless not defined $prefix or $prefix eq '';
return unless exists $self->[NSMAP]->[-1]->[PREFIX_MAP]->{$prefix};
This line (return unless not defined $prefix or $prefix eq '';) is
very strange. I have tested such test:
$prefix = 'alex';
print "alex\n" unless not defined $prefix or $prefix eq '';
After i see 'alexl'. Thus teh prefix will be alex or other string, we
will get return execution. Thus undeclare_prefix will not work properly.
If $prefix = '' i will not see "alex" string. And if $prefix will be
undef i don't see "alex" too (i think this is incorrect too)
My suggestion:
To change this line to
return if not defined($prefix);
This code will work if the prefix will be any string or '';