With the help of Debug::FaultAutoBT, you can try to get the backtrace extracted automatically, without any need for the core file. As of this writing this CPAN module is very new and doesn't work on all platforms.
To use this module we simply add the following code in the startup file:
use Debug::FaultAutoBT; use File::Spec::Functions; my $tmp_dir = File::Spec::Functions::tmpdir; die "cannot find out a temp dir" if $tmp_dir eq ''; my $trace = Debug::FaultAutoBT->new(dir => "$tmp_dir"); $trace->ready( );
This code tries to automatically figure out the location of the temporary directory, initializes the Debug::FaultAutoBT object with it, and finally uses the method ready( ) to set the signal handler, which will attempt to automatically get the backtrace. Now when we repeat the process of starting the server and issuing a request, if we look at the error_log file, it says:
SIGSEGV (Segmentation fault) in 29072 writing to the core file /tmp/core.backtrace.29072
And indeed the file /tmp/core.backtrace.29072 includes a backtrace similar to the one we extracted before, using the core file.