Skip Menu |

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

Report information
The Basics
Id: 28477
Status: resolved
Priority: 0/
Queue: XML-SAX

People
Owner: Nobody in particular
Requestors: DOUGW [...] cpan.org
Cc:
AdminCc:

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



In this: { no strict 'refs'; if (!keys %{"${parser_class}::"}) { eval "use $parser_class $version;"; } } return $parser_class->new(@parser_params); using XML::Filter::XSLT, "parser_class" is "XML::LibXML::SAX", and it does not hit the eval code above because the keys "Builder::" and "Parser::" exist even though the module is not loaded. Perhaps instead of keys, the test should be $parser_class->can('new') (also, then you don't need "no strict")?
Forgot to mention, this is in XML::SAX::ParserFactory. On Wed Jul 25 14:52:17 2007, DOUGW wrote: Show quoted text
> In this: > { > no strict 'refs'; > if (!keys %{"${parser_class}::"}) { > eval "use $parser_class $version;"; > } > } > > return $parser_class->new(@parser_params);
From: PEPL [...] cpan.org
The attached patch against 0.16 fixes this bug for me (where it occured when XML::Simple was used in the same httpd under mod_perl) On Wed Jul 25 14:53:29 2007, DOUGW wrote: Show quoted text
> Forgot to mention, this is in XML::SAX::ParserFactory. > > On Wed Jul 25 14:52:17 2007, DOUGW wrote:
> > In this: > > { > > no strict 'refs'; > > if (!keys %{"${parser_class}::"}) { > > eval "use $parser_class $version;"; > > } > > } > > > > return $parser_class->new(@parser_params);
>
--- /usr/share/perl5/XML/SAX/ParserFactory.pm 2007-09-17 15:52:26.000000000 +0200 +++ XML-SAX-0.16/SAX/ParserFactory.pm 2002-11-19 19:25:47.000000000 +0100 @@ -33,12 +33,10 @@ $version = " $1"; } - if (not exists $INC{$parser_class}) { + { + no strict 'refs'; + if (!keys %{"${parser_class}::"}) { eval "use $parser_class $version;"; - if ( $@ ) { - throw XML::SAX::Exception ( - Message => "Could not load $parser_class $version: $@", - ); } }
Thank you for your report. I have included a fix in the recent 0.96 release of XML::SAX and confirmed that the modules are loaded correctly in the XML::Filter::XSLT example you provided. Regards Grant