LOGO

____              _   _
|  _ \ _   _ _ __ | |_(_)_ __ ___   ___
| |_) | | | | '_ \| __| | '_ ` _ \ / _ \
|  _ <| |_| | | | | |_| | | | | | |  __/
|_| \_\\__,_|_| |_|\__|_|_| |_| |_|\___|

____       _
|  _ \  ___| |__  _   _  __ _  __ _  ___ _ __
| | | |/ _ \ '_ \| | | |/ _` |/ _` |/ _ \ '__|
| |_| |  __/ |_) | |_| | (_| | (_| |  __/ |
|____/ \___|_.__/ \__,_|\__, |\__, |\___|_|
                       |___/ |___/

NAME

Runtime::Debugger - Debug perl while its running.

VERSION

Version 0.03

SYNOPSIS

One can usually just do this:

# Insert this where you want to pause:
DB::single = 1;

# Then run the perl debugger to navigate there quickly:
PERLDBOPT='Nonstop' perl -d my_script

If that works for then great and dont' bother using this module!

Unfortunately for me, it was not working due to the scenario in which a script evals another perl test file and I would have liked to pause inside the test and see whats going on without having to keep rerunning the whole test over and over.

This module basically drops in a read,evaludate,print loop (REPL) whereever you need like so:

use Runtime::Debugger;
eval run;                # Not sure how to avoid using eval here while
                         # also being able to keep the lexical scope.
                         # Any ideas ? :)

Try with this command line:

perl -MRuntime::Debugger -E 'my $str1 = "str-1"; my $str2 = "str-2"; my @arr1 = "arr-1"; my @arr2 = "arr-2"; my %hash1 = qw(hash 1); my %hash2 = qw(hash 2);  eval run; say $@'

Press tab to autocomplete any lexical variables in scope (where "eval run" is found).

Saves history locally.

Can use 'p' to pretty print a variable or structure.

SUBROUTINES/METHODS

run

Runs the REPL (dont forget eval!)

eval run

Sets $@ to the exit reason like 'INT' (Control-C) or 'q' (Normal exit/quit).

p

Data::Dumper::Dump anything.

p 123
p [1, 2, 3]

Can adjust the maxdepth (default is 1) to see with: "#Number".

p { a => [1, 2, 3] } #1

Output:

{
  'a' => 'ARRAY(0x55fd914a3d80)'
}

Set maxdepth to '0' to show all nested structures.

uniq

Return a list of uniq values.

SEE ALSO

https://metacpan.org/pod/Devel::REPL

Great extendable module!

Unfortunately, I did not find a way to get the lexical variables in a scope. (maybe missed a plugin?!)

https://metacpan.org/pod/Reply

This module also looked nice, but same issue.

AUTHOR

Tim Potapov, <tim.potapov[AT]gmail.com>

BUGS

- no new lexicals

Currently its not possible to create any new lexicals variables while I have not yet found a way to run "eval" with a higher scope of lexicals. (perhaps there is another way?perhaps there is another way?)

You can make global variables though (with "our" keyword).

Please report any (other) bugs or feature requests to https://github.com/poti1/runtime-debugger/issues.

SUPPORT

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

perldoc Runtime::Debugger

You can also look for information at:

https://metacpan.org/Runtime::Debugger https://github.com/poti1/runtime-debugger

LICENSE AND COPYRIGHT

This software is Copyright (c) 2022 by Tim Potapov.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)