Subject: | Error string suppressed by CGI::Carp when $! is passed unquoted to die() |
Hi,
As from version 1.24 of CGI::Carp, it fails to print the error string to STDERR when the $! variable is passed unquoted to die(). Example:
use CGI::Carp;
$! = 5;
die $!;
CGI::Carp prints an error message without stating the reason, which in this case should have been: "Input/output error".
This is what the beginning of the die() function in CGI::Carp
currently looks like:
sub die {
my ($arg) = @_;
realdie @_ if ineval;
if (!ref($arg)) {
$arg = join("", @_);
After the call for ineval(), $_[0] contains the null string. I have located the reason for the behaviour to this line in the _longmess() function:
my $message = Carp::longmess();
i.e. it is in the Carp module that something happens...
Anyway, as a simple fix, I would suggest that the above lines from the die() function are replaced with:
sub die {
my ($arg) = @_;
my @args = @_;
realdie @args if ineval;
if (!ref($arg)) {
$arg = join("", @args);
With the hope that you'll find this report useful.
/ Gunnar