I have the same problem as in Can't disable stack trace in Carp::croak() for some reason. Because every call in the stack is considered "safe", croak()
prints out a full stack trace every time. I'd like to disable that for certain calls.
Here's an example:
use Carp;
sub this_may_fail {
# Some code...
croak "This call failed!";
}
sub regular_code {
this_may_fail();
}
regular_code();
Both subroutines are in the same package, so this_may_fail
is automatically marked as safe. Is there any way to tell Carp that this_may_fail
should be considered unsafe?
regular_code()
the only thing callingthis_may_fail
? If so then you could just use a regulardie
– Dodecagonthis_may_fail
gets called from several different locations, and I need to know where it was called from so I can figure out what went wrong. – Adopted