Hi LanX

I did a quick test using the workaround, but failed:(

It didn't stop at the breakpoint.

Please have a look and point out anything wrong with my test.

Thanks.

PS H:\store\workspace\myTestCodes> cat ~/.perldb $DB::alias{b} = q# s/^b\s+(\$\w+)\s*$/'"b ". DB::CvGV_name('.$1.')'/ee +; # PS H:\store\workspace\myTestCodes> cat .\test6.pl #!/usr/bin/env perl use 5.016; my $mysubref = sub { say "This is code Ref 0"; say "This is code Ref 1"; say "This is code Ref 2"; }; testMethod(); sub testMethod { say "in testMethod"; &{$mysubref}; } say "end the program"; PS H:\store\workspace\myTestCodes> perl -d .\test6.pl 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::(.\test6.pl:8): }; DB<1> n main::(.\test6.pl:10): testMethod(); DB<1> b $mysubref DB<2> L b .\test6.pl: 10: testMethod(); break if ($mysubref) DB<3> c in testMethod This is code Ref 0 This is code Ref 1 This is code Ref 2 end the program Debugged program terminated. Use q to quit or R to restart, use o inhibit_exit to avoid stopping after program termination, h q, h R or h o to get additional info. DB<3> q PS H:\store\workspace\myTestCodes> perl -v This is perl 5, version 16, subversion 3 (v5.16.3) built for MSWin32-x +86-multi-thread (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. PS H:\store\workspace\myTestCodes>

BR


In reply to Re^2: how to set a breakpoint by a code reference (workaround) by Matq
in thread how to set a breakpoint by a code reference by Matq

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.