Runtime-Debugger

 view release on metacpan or  search on metacpan

lib/Runtime/Debugger.pm  view on Meta::CPAN

package Runtime::Debugger;

=head1 LOGO

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

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

=cut

use 5.018;
use strict;
use warnings FATAL => 'all';
use Data::Dumper;
use Data::Printer(
    use_prototypes => 0,
    show_dualvar   => "off",
    hash_separator => " => ",
    end_separator  => 1,
    show_refcount  => 1,
    alias          => '_p',     # Avoids using 'p' for printing.
);
use Term::ReadLine;
use Term::ANSIColor qw( colored );
use PadWalker       qw( peek_our  peek_my );
use Scalar::Util    qw( blessed reftype );
use Class::Tiny     qw( term attr debug levels_up );
use YAML::XS();
use re      qw( eval );       # For debug.
use feature qw( say );
use parent  qw( Exporter );
use subs    qw( _uniq p );

our $VERSION = '1.13';
our @EXPORT  = qw( repl dd d p vars );
our %PEEKS;

=head1 NAME

Runtime::Debugger - Easy to use REPL with existing lexical support and DWIM tab completion.

(emphasis on "existing" since I have not yet found this support in other modules).

=cut

=head1 SYNOPSIS

In a script:

    use Runtime::Debugger;
    repl;

On the commandline:

    perl -MRuntime::Debugger -E 'repl'

Same, but with some variables to play with:

    perl -MRuntime::Debugger -E 'my $str1 = "Func"; our $str2 = "Func2"; my @arr1 = "arr-1"; our @arr2 = "arr-2"; my %hash1 = qw(hash 1); our %hash2 = qw(hash 2); my $coderef = sub { "code-ref: @_" }; {package My; sub Func{"My-Func"} sub Func2{"My-Fu...

From another script/function:

    my $var_to_find = 111;

    sub other {
        use Runtime::Debugger;
        repl( levels_up => 1 );
    }

=cut

=head1 DESCRIPTION

"What? Another debugger? What about ... ?"

=cut

=head2 Other Modules

=head3 perl5db.pl

The standard perl debugger (C<perl5db.pl>) is a powerful tool.

Using C<per5db.pl>, one would normally be able to do this:



( run in 1.011 second using v1.01-cache-2.11-cpan-e1769b4cff6 )