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

Perl Deparse plugin for Devel::Trepan via B::DeparseTree

SUMMARY

This adds deparse and deval commands to the Devel::Trepan debugger; deparse deparses Perl code; deval evaluates de-parsed Perl at the current point in the Perl program that you are stopped at.

DESCRIPTION

Perl reports location only at the granularity of a line number. Sometime you would like better or more precise information. For example suppose I am stopped on this line taken from File::Basename::fileparse:

     if (grep { $type eq $_ } qw(MSDOS DOS MSWin32 Epoc)) {  # ...

In a debugger, there happen to be to distinct locations in the code that you might be stopped in. The first place is before the grep starts at all. Here, deparse will show:

      grep { $type eq $_; } 'MSDOS', 'DOS', 'MSWin32', 'Epoc'

But also you might be stopped inside grep. Here deparse will show:

    # code to be run next...
    $type
    # contained in...
    $type eq $_

Knowing which of these two locations can be helpful. For example if you are stopped in the latter location, you can evaluate `$_` to see where in the loop you are at.

See Exact Perl location with B::Deparse (and Devel::Callsite).

deparse

Deparses Perl from interpreter OPs. See deparse for more information and command syntax.

deval

This is somewhat like eval or eval? which evaluates the Perl code that is about to be run, but (when it works), it can be more reliable. Eval works on simple-minded string manipulation via regular expressions to pull out what to evaluate, whereas deval gets its information directly from the interpreter code.

See deval for more information and command syntax.

AUTHORS

Rocky Bernstein

COPYRIGHT

Copyright (C) 2015 Rocky Bernstein <rocky@cpan.org>

This program is distributed WITHOUT ANY WARRANTY, including but not limited to the implied warranties of merchantability or fitness for a particular purpose.

The program is free software. You may distribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation (either version 2 or any later version) and the Perl Artistic License as published by O'Reilly Media, Inc. Please open the files named gpl-2.0.txt and Artistic for a copy of these licenses.