Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Alas, watch-expression not obvious to this one

by throop (Chaplain)
on Feb 05, 2007 at 19:07 UTC ( #598383=perlquestion: print w/replies, xml ) Need Help??

throop has asked for the wisdom of the Perl Monks concerning the following question:

Brethern, perlman debug sez, concerning the 'watch expression':
w expr
Add a global watch-expression. We hope you know what one of these is, because they're supposed to be obvious.
Alas, I don't understand. I'm not even using it right when I try to watch a single variable.
w $negatePrefix
But what I really want to do is to watch a particular place within a HoH:
w $onto{'PROBLEM'}{'mappings'}
Can some one give me a more full example of how to use this powerful feature?


Replies are listed 'Best First'.
Re: Alas, watch-expression not obvious to this one
by almut (Canon) on Feb 05, 2007 at 20:31 UTC

    What problems do you have?   For me, it seems to work as specified:

    Assuming the following program

    #!/usr/bin/perl for my $c (1..1000) { $onto{'PROBLEM'}{'mappings'} = "foo" if $c == 99; }

    here's an example session:

    $ perl -d Loading DB routines from version 1.28 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main::( for my $c (1..1000) { DB<1> w $onto{'PROBLEM'}{'mappings'} DB<2> c Watchpoint 0: $onto{'PROBLEM'}{'mappings'} changed: old value: '' new value: 'foo' main::( $onto{'PROBLEM'}{'mappings'} += "foo" if $c == 99; DB<2> p $c 100 DB<3> c Watchpoint 0: $onto{'PROBLEM'}{'mappings'} changed: old value: 'foo' new value: '' 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

    Maybe you're using an old version of Perl - I dimly remember that commands were slightly different in 5.6.x (I think 'w' was 'W', but I could be wrong).

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://598383]
Approved by Joost
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2022-07-01 14:26 GMT
Find Nodes?
    Voting Booth?
    My most frequent journeys are powered by:

    Results (99 votes). Check out past polls.