NAME

Enbugger - Enables the debugger at runtime.

SYNOPSIS

eval { ... };
if ( $@ ) {
    # Oops! there was an error! Enable the debugger now!
    require Enbugger;
    $DB::single = 2;
    Enbugger->import( 'ebug' );
}

DESCRIPTION

Allowes the use of the debugger at runtime regardless of whether your process was started with debugging on.

ENABLING THE DEBUGGER

The debugger is loaded automatically when Enbugger is loaded. Calling Enbugger->import also enables single stepping. This is optional but it seems like a reasonable default.

# Installs the debugger.
require Enbugger;

# Enables the debugger
Enbugger->import( 'perl5db' );

Or...

eval 'use Enbugger';

DISABLING THE DEBUGGER

Disables single stepping.

Enbugger->unimport;

Or...

eval 'no Enbugger';

EXAMPLES

DEBUGGING ON EXCEPTION

Maybe you don't expect anything to die but on the chance you do, you'd like to do something about.

$SIG{__DIE__} = sub {
    require Enbugger;
    $DB::single = 3;
    Enbugger->import( 'ptkdb' );
};

DEBUGGING ON SIGNAL

You could include this snippet in your program and trigger the debugger on SIGUSR1. Then later, when you're wondering what's up with your process, send it SIGUSR1 and it starts the debugger on itself.

$SIG{USR1} = sub {
    require Enbugger;
    $DB::single = 2;
    Enbugger->import( 'sdb' );
};

Later:

$ kill -USR1 12345

INSTALLATION

To install this module type the following:

perl Makefile.PL
make
make test
make install

DEPENDENCIES

A C compiler.

AUTHOR

Josh ben Jore <jjore@cpan.org>

COPYRIGHT AND LICENCE

Copyright (C) 2007 by Josh ben Jore

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.