NAME
Carp::REPL - read-eval-print-loop on die
VERSION
Version 0.07 released 10 Jul 07
SYNOPSIS
The intended way to use this module is through the command line.
perl tps-report.pl
Can't call method "cover_sheet" without a package or object reference at tps-report.pl line 6019.
perl -MCarp::REPL tps-report.pl
Can't call method "cover_sheet" without a package or object reference at tps-report.pl line 6019.
$ map {"$_\n"} $form, $subform
27B/6
Report::TPS::Subreport=HASH(0x86da61c)
FUNCTIONS
repl
This module's interface consists of exactly one function: repl. This is provided so you may install your own $SIG{__DIE__}
handler if you have no alternatives.
It takes the same arguments as die, and returns no useful value. In fact, don't even depend on it returning at all!
One useful place for calling this manually is if you just want to check the state of things without having to throw a fake error. You can also change any variables and those changes will be seen by the rest of your program.
use Carp::REPL;
sub involved_calculation
{
# ...
$d = maybe_zero();
# ...
Carp::REPL::repl; # $d = 1
$sum += $n / $d;
# ...
}
Unfortunately if you instead go with the usual -MCarp::REPL
, then $SIG{__DIE__}
will be invoked and there's no general way to recover. But you can still change variables and poke at things.
COMMANDS
Note that this is not supposed to be a full-fledged debugger. A few commands are provided to aid you in finding out what went awry. See Devel::ebug if you're looking for a serious debugger.
:u
Moves one frame up in the stack.
:d
Moves one frame down in the stack.
:t
Redisplay the stack trace.
:q
Close the REPL. (
^D
also works)
VARIABLES
$_REPL
This represents the Devel::REPL object (with the LexEnvCarp plugin, among others, mixed in).
$_a
This represents the arguments passed to the subroutine at the current frame in the call stack. Modifications are ignored (how would that work anyway? Re-invoke the sub?)
CAVEATS
Dynamic scope probably produces unexpected results. I don't see any easy (or even difficult!) solution to this. Therefore it's a caveat and not a bug. :)
SEE ALSO
AUTHOR
Shawn M Moore, <sartak at gmail.com>
BUGS
No known bugs at this point. To expect that to stay true is laughably naive. :)
Please report any bugs or feature requests to bug-carp-repl at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Carp-REPL. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Carp::REPL
You can also look for information at:
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
RT: CPAN's request tracker
Search CPAN
ACKNOWLEDGEMENTS
Thanks to Nelson Elhage and Jesse Vincent for the idea.
Thanks to Matt Trout and Stevan Little for their advice.
COPYRIGHT & LICENSE
Copyright 2007 Best Practical Solutions, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 150:
'=item' outside of any '=over'