ActivePerl 5.8.7 crashes

Discussion in 'Perl Misc' started by Dave, Oct 20, 2005.

  1. Dave

    Dave Guest

    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);
     
    Dave, Oct 20, 2005
    #1
    1. Advertising

  2. Dave

    Sisyphus Guest

    "Dave" <> wrote in message
    ..
    ..
    > 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
     
    Sisyphus, Oct 21, 2005
    #2
    1. Advertising

  3. Dave

    Dave Guest

    "Sisyphus" <> wrote in message
    news:435848fa$0$2135$...
    >
    > "Dave" <> wrote in message
    > .
    > .
    >> 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
    >
    >


    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!
     
    Dave, Oct 21, 2005
    #3
  4. Dave

    Sisyphus Guest

    "Dave" <> wrote in message

    > >
    > > 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.


    >
    > 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
     
    Sisyphus, Oct 21, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. marko
    Replies:
    0
    Views:
    1,101
    marko
    Jul 19, 2003
  2. WS
    Replies:
    0
    Views:
    680
  3. Skybuck Flying

    Make and ActivePerl

    Skybuck Flying, Dec 7, 2004, in forum: Perl
    Replies:
    3
    Views:
    2,988
  4. Jason Cochran

    SQL Server 2000 DTS and ActivePerl

    Jason Cochran, Dec 2, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    359
    Jason Cochran
    Dec 2, 2003
  5. Ted
    Replies:
    7
    Views:
    563
    Sisyphus
    Dec 16, 2006
Loading...

Share This Page