CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate:
Deugger Watchpoint when it goes out of scope



Jul 24, 2011, 9:42 PM

Post #1 of 1 (2215 views)
Deugger Watchpoint when it goes out of scope Can't Post

Greetings, friends & family. This is Ole' Rasputin with another head-scratcher.

I was debugging for a subtle error when I realized I need a watchpoint on a component of an object inside a method. Specifically:

my $pfile = shift(@_);  # The parameter was an object reference. 
$pfile->{max_wholes}[$lc] = something under some condition.

So $pfile is a local variable to the subroutine.

Once inside the subroutine, I set a watchpoint on $pfile->{max_wholes}[1]. Sure enough, within the subroutine, if $pfile->{max_wholes}[1] changes, it breaks out to the debugger. However, I am also getting two additional traps: When the execution enters the method and when it exits (Changed from 6 to '').

That's plain nuts, aside from being a distraction. Of course the location remains safe when I exit the method; I can still reference $variable->{max_wholes}[1] in the calling routine and it has not changed. Only that local variable, $pfile, has gone away. So this watchpoint break - when the variable goes out of scope - is really spurious. The Perl Debugger Reference Card at does not list commands or conditions on watchpoints.

I found an unsatisfying (for my case) workaround at

As an aside, I recall using a C debugger that allowed me to issue commands and continue at each breakpoint and watchpoint. No, I haven't read through the entire perldoc on the debugger but the reference card would surely list such options if they existed.

Ideas, anyone? This is not a show-stopper, just a gluteal pain.

Thanks much!
-- Rasputin Paskudniak (In perpetual pursuit of undomesticated, semi-aquatic avians)


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives