in reply to eval not catching XML Parser die

Oh dear, oh dear,

Sorry, my debugging / problem searching ability seems to have deserted me on this one.

the base problem can be isolated on a much simpler script

It segfaults on linux under 5.6.1

It doesnt segfault on Solaris with perl 5.00503

use strict; use XML::Simple; for ('./news-arabic-business.xml') { my $xmlfile = $_; my $struct; my $parser = new XML::Simple( forcearray => 1 ); eval { $struct = $parser->XMLin( $xmlfile ); die "wibble " unless ref $struct eq 'HASH'; }; if ($@) { print "$@ \n"; next; }; }
where all the xml file has to contain is

< ?xml version="1.0" encoding="Windows-1256"? >

on Solaris the modules are older versions.

Replies are listed 'Best First'.
Re: Re: eval not catching XML Parser die
by grantm (Parson) on Jun 24, 2002 at 15:50 UTC

    Here's my reduced test case:

    use strict; use XML::Simple; my $xml = q(<?xml version="1.0" encoding="Windows-1256"?> <stuff>nope</stuff> ); my $ref = eval { XMLin( $xml ) }; print $@ if($@); print "About to exit\n"; #exit(0);

    Notice the 'exit(0)' line is commented out. If you remove the '#', the segfault goes away (Linux, Perl 5.6.1).