http://qs321.pair.com?node_id=1063043


in reply to how to set a breakpoint by a code reference

I'm not sure where you are getting
b $mysubref
from. The doc I see says this, which seems to be the behaviour you are triggering:
b [line] [condition] Set a breakpoint before the given line. If a condition is specified, it's evaluated each time the statement is reached: a breakpoint is taken only if the condition is true. Breakpoints may only be set on lines that begin an executable statement. Conditions don't use "if":
That is, you are setting a break point at the current line (because you specify no line) if $mysubref is true.
--
A math joke: r = | |csc(θ)|+|sec(θ)| |-| |csc(θ)|-|sec(θ)| |

Replies are listed 'Best First'.
Re^2: how to set a breakpoint by a code reference
by Matq (Initiate) on Nov 19, 2013 at 01:43 UTC
    Here is the output document,
    C:\Users>perl -d -e 0 Loading DB routines from perl5db.pl version 1.37 Editor support available. Enter h or 'h h' for help, or 'perldoc perldebug' for more help. main::(-e:1): 0 DB<1> h b b Sets breakpoint on current line) b [line] [condition] Set breakpoint; line defaults to the current execution line; condition breaks if it evaluates to true, defaults to '1'. b subname [condition] Set breakpoint at first line of subroutine. b $var Set breakpoint at first line of subroutine referenced by + $var. b load filename Set breakpoint on 'require'ing the given file. b postpone subname [condition] Set breakpoint at first line of subroutine after it is compiled. b compile subname Stop after the subroutine is compiled. DB<2> q C:\Users>perl -v This is perl 5, version 16, subversion 3 (v5.16.3) built for MSWin32-x +86-multi-t hread (with 1 registered patch, see perl -V for more detail) Copyright 1987-2012, Larry Wall Binary build 1603 [296746] provided by ActiveState http://www.ActiveSt +ate.com Built Mar 13 2013 11:29:21 Perl may be copied only under the terms of either the Artistic License + or the GNU General Public License, which may be found in the Perl 5 source ki +t. Complete documentation for Perl, including FAQ lists, should be found +on this system using "man perl" or "perldoc perl". If you have access to + the Internet, point your browser at http://www.perl.org/, the Perl Home Pa +ge.
      Interesting; that doesn't match perldoc perldebug.
      --
      A math joke: r = | |csc(θ)|+|sec(θ)| |-| |csc(θ)|-|sec(θ)| |
        > Interesting; that doesn't match perldoc perldebug.

        perldebug :

        - b subname [condition] Set a breakpoint before the first line of the named subroutine. subnam +e may be a variable containing a *code reference* (in this case condi +tion is not supported).

        Cheers Rolf

        ( addicted to the Perl Programming Language)