The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Carp::Reply - get a repl on exceptions in your program

VERSION

version 0.02

SYNOPSIS

  perl -MCarp::Reply script.pl

or

  use Carp::Reply ();

  sub foo {
      # ...
      Carp::Reply::repl();
      # ...
  }

DESCRIPTION

Carp::Reply provides a repl to use within an already running program, which can introspect the current state of the program, including the call stack and current lexical variables. It works just like Reply, with the addition of some commands to move around in the call stack.

The lexical environment is set to the lexical environment of the current stack frame (and is updated when you use any of the commands which move around the stack frames).

Carp::Reply also installs a __DIE__ handler which automatically launches a repl when an exception is thrown. You can suppress this behavior by passing an empty import list, either via use Carp::Reply (); or perl -mCarp::Reply.

FUNCTIONS

repl

Invokes a repl at the current point of execution.

COMMANDS

#backtrace

(Aliases: #trace, #bt)

Displays a backtrace from the location where the repl was invoked. This is run automatically when the repl is first launched.

#top

(Aliases: #t)

Move to the top of the call stack (the outermost call level).

#bottom

(Aliases: #b)

Move to the bottom of the call stack (where the repl was invoked).

#up

(Aliases: #u)

Move up one level in the call stack.

#down

(Aliases: #d)

Move down one level in the call stack.

#list

(Aliases: #l)

Displays a section of the source code around the current stack frame. The current line is marked with a *.

#env

Displays the current lexical environment.

BUGS

No known bugs.

Please report any bugs through RT: email bug-carp-reply at rt.cpan.org, or browse to http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Reply.

SEE ALSO

Carp::REPL

SUPPORT

You can find this documentation for this module with the perldoc command.

    perldoc Carp::Reply

You can also look for information at:

AUTHOR

Jesse Luehrs <doy at cpan dot org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2013 by Jesse Luehrs.

This is free software, licensed under:

  The MIT (X11) License