The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

RapidApp::TraceCapture

DESCRIPTION

This module contains a number of useful functions for capturing stack traces.

The writeQuickTrace and writeFullTrace functions send their output to the file specified by the environment variable TRACE_OUT_FILE, or default to /tmp/RapidApp_Error_Traces if unset.

SYNOPSIS

  try {
    local $SIG{__DIE__}= \&RapidApp::TraceCapture::captureTrace;
    
    # do stuff
    do->stuff();
    
    # clear any stack traces we might have picked up, since none were fatal
    RapidApp::TraceCapture::collectTraces;
  }
  catch {
    my $err= $_;
    my @traces= RapidApp::TraceCapture::collectTraces;
    for my $trace (@traces) {
      RapidApp::TraceCapture::writeFullTrace($trace);
    }
  };