[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Stack Trace

Dear Ledgersmb developers in order for me to debug applications I use a
what I call a 'stack trace'. To do this in Ledgersmb I have some code in
the beginning of every subroutine  like so:

if ( ${LedgerSMB::Sysconfig::debug} ) {
        open FILE, '>>', "../debug.txt";
        my $debug_sub  = ( caller(0) )[3],;
        my $debug_file = __FILE__,;
        $debug_sub =~ s/.*:://g;
        print FILE __FILE__, " sub $debug_sub Line: ", __LINE__, "\n";
        print FILE "Caller: ", caller, "\n\n";
        close FILE;

In Form.pm, User.pm or other frequently hit files I will add varying
levels if ( ${LedgerSMB::Sysconfig::debug} > 2 )

I end up with a file that steps through the program like so:
arap.pl 1310 continue

pe.pl  1138 sub project_report
LedgerSMB/PE.pm sub projects Line: 45
Caller: mainbin/pe.pl1146

Is there any easier way to achieve this in 1.4?

"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
Ledger-smb-devel mailing list