- SEE ALSO
- COPYRIGHT AND LICENCE
- DISCLAIMER OF WARRANTIES
Pry - intrude on your code
use Pry; ...; pry; ...;
Kind of a bit like a debugger, kind of a bit like a REPL.
This module gives you a function called
pry that you can drop into your code anywhere. When Perl executes that line of code, it will stop and drop you into a REPL. You can use the REPL to inspect any lexical variables (and even alter them), call functions and methods, and so on.
All the clever stuff is in the REPL. Rather than writing yet another Perl REPL, Pry uses Reply, which is an awesome yet fairly small REPL with support for plugins that can do some really useful stuff, such as auto-complete of function and variable names.
Once you've finished using the REPL, just hit Ctrl+D and your code will resume execution.
Starts the Pry REPL.
Dumps selected variables before starting the Pry REPL.
Note a list of variable names is expected; not values. For example:
my $x = 42; my @y = (666, 999); pry('$x', '@y');
The following functions are provided for your convenience. They cannot be exported, so you should access them, from the REPL, using their fully-qualified name.
Returns a hashref of your lexical variables.
Returns the stack trace as a Devel::StackTrace object.
Dumps variables (which must exist somewhere in the
Decides the backend dumper implementation used by
Pry::Dump(). Valid values are "Data::Dump" and "Data::Dumper".
Pry's REPL can be configured in the same way as Reply.
I imagine this probably breaks pretty badly in a multi-threaded or multi-process scenario.
Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=Pry.
Toby Inkster <email@example.com>.
This software is copyright (c) 2014 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.