Generating A Stacktrace with Carp.pm 

use Carp qw(verbose croak);

# and later ...

open my $fh, '>', $state_file or croak "open($state_file): $!";
open(my_state): Permission denied at report.pl line 182
    main::save_state('RUNNING') called at report.pl line 178
    main::start_running() called at report.pl line 120
    main::run_report('2006-01-01', '2006-03-31') called at
    report.pl line 29