Is it possible to print 'fine' stacktrace with function params interpolated, such as Data::Dumper does? Instead of last line of this
check_module_auth_cookie........... disabled, ok.
check_module_auth_ntlm............. no NTLM, ok.
check_module_auth_opensso.......... no OpenSSO, ok.
check_module_auth_tinysso.......... no TinySSO, ok.
checksums........................... SDBM, ok.
checksum hashes...
/etc/lighttpd/sites/holding2/docroot/dbm/db_model.sdbm... Couldn't tie SDBM file /etc/lighttpd/sites/holding2/docroot/dbm/db_model.sdbm: Отказано в доступе
at /var/vh/eludia/Eludia/Content/Checksums/SDBM.pm line 52
HOLDING::checksum_init('db_model') called at /var/vh/eludia/Eludia/Content/Checksums.pm line 195
HOLDING::BEGIN() called at /var/vh/eludia/Eludia/Content/Checksums.pm line 206
eval {...} called at /var/vh/eludia/Eludia/Content/Checksums.pm line 206
require Eludia/Content/Checksums.pm called at /var/vh/eludia/Eludia.pm line 682
HOLDING::check_module_checksums() called at /var/vh/eludia/Eludia.pm line 961
HOLDING::BEGIN() called at /var/vh/eludia/Eludia/Content/Checksums.pm line 206
eval {...} called at /var/vh/eludia/Eludia/Content/Checksums.pm line 206
require Eludia.pm called at (eval 74) line 1
eval 'package HOLDING; require Eludia;' called at /var/vh/eludia/Eludia/Loader.pm line 28
Eludia::Loader::import('Eludia::Loader', 'ARRAY(0x41cf228)', 'HOLDING', 'HASH(0x41defc8)') called at (eval 72) line 7
I want to see
Eludia::Loader::import('Eludia::Loader',
[
'/var/projects/app',
'/var/projects/submodule'
],
'HOLDING',
{
mail_configuration => {etc..}
}
) called at (eval 72) line 7
In other words, substitute 'ARRAY(0x..)' and 'HASH(0x..)' in stacktrace
by their actual, useful values.
Analyze external stack tracesFrom the main menu, select Code | Analyze Stack Trace or Thread Dump. In the Analyze Stack Trace dialog that opens, paste the external stack trace or thread dump into the Put a stacktrace here: text area. Click OK. The stack trace is displayed in the Run tool window.
A stack trace is a report that provides information about program subroutines. It is commonly used for certain kinds of debugging, where a stack trace can help software engineers figure out where a problem lies or how various subroutines work together during execution.
The stack trace contains the Exception's type and a message, and a list of all the method calls which were in progress when it was thrown.
By setting your own signal handler you can customize the output without having to change how the errors are thrown. The Devel::StackTrace provides convenient access to stack trace data.
use Data::Dumper;
use Devel::StackTrace;
sub FatalErr {
my ($message) = @_;
my $trace = new Devel::StackTrace();
$Data::Dumper::Terse = 1;
print "$message";
$trace->next_frame for 1..2;
while (my $frame = $trace->next_frame) {
my $arg_str = Dumper($frame->args);
$arg_str =~ s/^/ /gm;
$arg_str =~ s/^\s+//;
printf ' during call to %1$s(%2$s) at %4$s:%5$s', $frame->subroutine, $arg_str, $frame->package, $frame->filename, $frame->line;
print "\n";
}
}
BEGIN{ $SIG{__DIE__} = \&FatalErr } # attaches the custom signal handler
this generates output like:
something bad happened at ./dietest.pl line 41.
during call to stuff::foo() at dietest.pl:46
during call to things::bar({
'fruit' => [
'apple',
'orange',
'pear'
],
'veggies' => [
'peas',
'carrots'
]
}
[
0,
1,
2
]
) at dietest.pl:36
something bad happened at ./dietest.pl line 41.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With