Skip Menu |

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

Report information
The Basics
Id: 36096
Status: resolved
Priority: 0/
Queue: XML-Parser

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

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



Subject: obscure extern ent handler issue (lexical GLOB)
You might argue that this bug isn't a bug because, the docs clearly indicate that you must return any one of the following from an external entity handler: - return a *GLOB (the global all caps symbols as a glob) - return a ref (to an object like IO::Handle) - return undef I was returning a lexical glob (ie open my $fh, "filename") and that waas passing on 85% of the perls out there. I had to build quite a few perls to produce the problem on my one machine so I could track it down. I feel that it'd be best to treat it as a bug since it's shockingly difficult to figure out when your tests pass on all your own machines but not *some* of the CPAN Testers machines. I have attached a test which, if you include in the XML::Parser distribution, will fail on 15% of the perl5.8 and perl5.10s (and 100% of the perl5.6es, since it uses open my $fh). -- If riding in an airplane is flying, then riding in a boat is swimming. 85 jumps, 36.0 minutes of freefall, 69.1 freefall miles.
Subject: extern_ent_lexical_glob.t
use strict; use Test; plan tests => 3; use XML::Parser; eval { do { open my $testxml, ">test.xml" or die $!; open my $testdtd, ">test.dtd" or die $!; print $testxml <<EOF <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE test SYSTEM "test.dtd"> <test> <a> <b c="0"> </b> </a> </test> EOF ; print $testdtd <<EOF <!ELEMENT test (a*)> <!ELEMENT a (b*)> <!ELEMENT b EMPTY> <!ATTLIST b c CDATA #REQUIRED> EOF ; }; my $p1 = XML::Parser->new(ErrorContext=>2, ParseParamEnt=>1, $ENV{DEBUG} ? (Style => 'Debug') : ()); $p1->parsefile('test.xml'); }; warn "WARNING: failed to parse xml docs: $@" if $@; ok($@ ? 0 : 1); eval { my @nodoom = ( Handlers=>{ExternEnt => sub { my ($base, $name) = @_[1,2]; my $fname = ($base ? File::Spec->catfile($base, $name) : $name); open _TESTHANDLE, $fname or open _TESTHANDLE, $name or return undef; # warn "file=*_TESTHANDLE; ref-type=" . ref *_TESTHANDLE; *_TESTHANDLE; }}, ); my $p2 = XML::Parser->new(ErrorContext=>2, ParseParamEnt=>1, $ENV{DEBUG} ? (Style => 'Debug') : (), @nodoom); $p2->parsefile('test.xml'); }; warn "WARNING: failed to parse xml docs: $@" if $@; ok( $@ ? 0 : 1 ); eval { my @doom = ( Handlers=>{ExternEnt => sub { my ($base, $name) = @_[1,2]; my $fname = ($base ? File::Spec->catfile($base, $name) : $name); my $fh; open $fh, $fname or open $fh, $name or return undef; # warn "file=$fh ref-type=" . ref $fh; $fh; }}, ); my $p2 = XML::Parser->new(ErrorContext=>2, ParseParamEnt=>1, $ENV{DEBUG} ? (Style => 'Debug') : (), @doom); $p2->parsefile('test.xml'); }; warn "WARNING: failed to parse xml docs: $@" if $@; my $result = ($@ ? 0 : 1); ok( $result );
Ticket migrated to github as https://github.com/toddr/XML-Parser/issues/44