Herkum has asked for the wisdom of the Perl Monks concerning the following question:

I am using XML::Twig and setting twig_handlers to parse the actual document. The problem I am encountering is that the parser mysteriously dies parsing some relatively simple documents. Below are the handlers being called.

my $handlers = { 'request' => sub { $self->_handler_set_object('request', @_ ) +; # got to here with a warn statement }, $response => sub { $self->_handler_set_object('response', @_ ) +; $self->_object_tree( $response, @_ ) +; # Got to Here, with a warn statement }, }; eval { $self->twig( XML::Twig->new( twig_handlers => $handlers )) +}; croak 'ERROR: ' . $EVAL_ERROR if $EVAL_ERROR; # Got Here eval { $self->twig->parse( $self->get_xml ) }; # Cannot get to here croak 'ERROR: ' . $EVAL_ERROR . qq{\nXML: } . $self->get_xml if $E +VAL_ERROR;

I think the XML parsing engine is blowing up because I never get to the croak error message when it dies. I could upgrade the XML libraries and hope that fixes the problem but I am not familiar with what libraries I would have to update. I like Twig because the code was fairly easy to write, and would rather not have to use something more complex if I can avoid it.

Anyone got any ideas.

Replies are listed 'Best First'.
Re: XML::Twig Unexplained Handler dies
by ikegami (Patriarch) on Nov 04, 2008 at 21:09 UTC
    Windows or non-Windows? What's the error code with which the process exits (echo $?)?

      This is a Ubuntu 8.04 desktop, and I am running the code inside of a perl testing suite (just to give context).

      When I run the echo $? it displays a 255.

        I was hoping it might have been caused by some signal, but 255 is an odd value (signal 127 with core dump). It's probably some special value whose meaning I don't know. Sorry, can't help.
Re: XML::Twig Unexplained Handler dies
by GrandFather (Saint) on Nov 04, 2008 at 22:32 UTC

    Can you golf a failing XML document down to a minimum to reproduce the problem? If it is small you could post it here, but in any case you should probably raise a bug at rt://XML::Twig.


    Perl reduces RSI - it saves typing

      I can probably do that tomorrow, if I have no other options. I was so proud of this code and it has left me a broken man to watch me be unable to do anything about this sort of problem at this point.