I ran into a problem using the Carp module in an INIT block while using
the XML::Parser module.  It seems as though there is something
uninitialized within the module until after the INIT block.  Once my
INIT block is completed, all is well.  Anyone understand why using it is
problematic here?

I get a segmentation fault when using croak, but if I change it to die,
everything works fine.

Contents of testApp.pl
---------------------------------
#!/usr/local/bin/perl -w

use testModule;

sub main;
main;

sub main
{  
    print STDOUT "In main";
}



Contents of testModule.pm
---------------------------------------
#!/usr/local/bin/perl -w

package testModule;
use Carp;
use XML::Parser;

INIT
{
   eval { testModule->exceptionThrower; };
}

sub exceptionThrower
{
    my ($startHandler);
    $startHandler = sub { croak "My exception"; };
    my $parser = XML::Parser->new(Handlers => {Start => $startHandler});
    $parser->parse("<a/>");
}

1;




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to