XML-Simple - Error with Carp when using XML::Simple

Posted on Tue Oct 24 04:45:55 2006 by lschult2
Error with Carp when using XML::Simple
Hello,

I am having an error with Carp when I use XML::Simple. I created a perl script that shows the issue. The script is setting a sig die handler using CGI::Carp, and then displaying a nice message on the screen. See the end of this message for the script. Here are some links to the script in action.

First Case Second Case

The only difference is that the first case the die happens before XMLin is called, and the second case the die happens after XMLin is called.

When I run this on my local windows box, both cases work (the die is intercepted and displays the nice message). But when I run it on my unix box "sandbox.wineinsight.com", the second case fails every time (The die is not intercepted and no message is displayed).

Here is a perl script that shows the issue:

#!/usr/bin/perl BEGIN { use CGI::Carp qw(fatalsToBrowser set_message); set_message(\&cgidie); $main::SIG{__DIE__}=\&CGI::Carp::croak; } use CGI; use XML::Simple; sub cgidie { local ($message) = @_; print qq~ <html> <H1 style="color: black">Software error:</H1> <pre style="font: 8pt Courier New; color: red">$message</pre> </body> </html> ~; exit; } my $xml = qq~<attr> </attr> ~; die "here:x" if CGI::param('x'); my $attrref = XMLin($xml); die "here:y" if CGI::param('y');
Direct Responses: 3316 | Write a response