ActivePerl 5.8.7 crashes

D

Dave

The following program (I have removed all the functionality but retained the
problem), causes Perl to crash with a 'Free to wrong pool' error when fed
with a large XML file containing Unicode data. (but not with a minimal xml
unicode file).

Perl 5.8.6 on cygwin runs fine.

If I remove the binmode line it is OK.

It is the executable rather than the shell that causes the problem (as I
have fed the Activestate version from the cygwin shell and the cygwin perl
from the cmd shell to test this).

Does anyone know why?


use XML::parser;
use strict;
use warnings;

binmode(STDIN, ":utf8") or die "Couldn't binmode STDIN";

my $parser = new XML::parser(Handlers => {Start => sub {},
End => sub {},
Char => sub {}});
$parser->parse(*STDIN);
 
S

Sisyphus

..
..
If I remove the binmode line it is OK. ..
..

use XML::parser;
use strict;
use warnings;

binmode(STDIN, ":utf8") or die "Couldn't binmode STDIN";

my $parser = new XML::parser(Handlers => {Start => sub {},
End => sub {},
Char => sub {}});
$parser->parse(*STDIN);

Do you really need to binmode STDIN ?
If you haven't already, carefully check the 'perldoc -f binmode' and
'perldoc -f open' documentation for some ideas that might enable you to fix
the problem.

Cheers,
Rob

Cheers,
Rob
 
D

Dave

Sisyphus said:
.
.

Do you really need to binmode STDIN ?
If you haven't already, carefully check the 'perldoc -f binmode' and
'perldoc -f open' documentation for some ideas that might enable you to
fix
the problem.

Cheers,
Rob

Cheers,
Rob

Prior to using XML::parser I was using regular expressions to parse the XML
file. In that case the binmode was necessary or the utf-8 was read in as
bytes. (My guess is that XML::parser is also interpreting the utf-8 in some
way and so with binmode on we are getting a double conversion issue of some
sort.) What is odd is that it works fine with some versions of the perl
interpreter but not with the ActiveState version.
I can easily fix the problem by moving the binmode statement into the
regex_parse fallback sub in my larger bit of code (just in case I have a
problem with XML::parser later on), I just wondered why it was happening. I
am not used to the perl interpreter crashing out - even on Windows!
 
S

Sisyphus

Prior to using XML::parser I was using regular expressions to parse the XML
file. In that case the binmode was necessary or the utf-8 was read in as
bytes.

I was thinking that perhaps you could use open() to establish ":utf8" as the
default I/O layer, rather than binmode().

Cheers,
Rob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top