According to the Carp module documentation, croak()
should not produce any stack trace unless $Carp::Verbose
evaluates to true. But for some reasone, croak()
always behaves like confess()
in my environment, i.e. always printing a stack trace, even when it should not..
Here is a test script:
#!/usr/bin/perl
use Modern::Perl;
use Carp;
sub func
{
say "Carp::Verbose = $Carp::Verbose";
croak "There should be no stack trace after this message!";
}
sub main
{
func();
}
main;
And here is the result it produces on my system:
$ ./croak
Carp::Verbose = 0
There should be no stack trace after this message! at ./croak line 8
main::func() called at ./croak line 13
main::main() called at ./croak line 16
Maybe someone has encountered this issue or has any clue about the root cause?
Here is some info about my environment:
Ubuntu 12.04 LTS
Linux 3.2.0-27-generic x86_64
perl 5, version 14, subversion 2 (v5.14.2) built for x86_64-linux-gnu-thread-multi
Also I get the same wrong behavior on my SL6 system:
Scientific Linux SL release 6.3 (Carbon)
kernel-2.6.32-279.1.1.el6.x86_64
perl, v5.10.1 (*) built for x86_64-linux-thread-multi