perl breakpoints

Kevin D. Clark kclark at CetaceanNetworks.com
Tue Sep 9 15:14:59 EDT 2003


Brian Medley <bpm-list-blu at 4321.tv> writes:

> I am trying to store breakpoints in the perl debugger's rc file.  I have
> found a way to do this, but I am curious if anyone knows a better way (as
> in, officially supported - I don't know if what I came up just "happens" to
> work or if it's what they want done in this situation).
> 
> As shown below, I would like the ability to set a breakpoint for mulitple
> files.
> 
> sub afterinit {
>     $postponed_file{"../lib/Package.pm"}{26} = 1;
>     $postponed_file{"main.pl"}{55} = 1;
> }

Instead of this, I'd recommend just putting the following code snippet
on the lines that you want the breakpoint to exist at:

        $DB::single = 1;

This will cause a break to happen if you're running under the
debugger. 

This is a lot less brittle than hardcoding line numbers.  Also, this
code is harmless if you aren't running underneath the debugger.

Hope this helps,

--kevin
-- 
Kevin D. Clark / Cetacean Networks / Portsmouth, N.H. (USA)
cetaceannetworks.com!kclark (GnuPG ID: B280F24E)
alumni.unh.edu!kdc




More information about the Discuss mailing list