Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: No Pause on Elsif in Debugger

by qq (Hermit)
on Jul 22, 2004 at 22:48 UTC ( #376749=note: print w/ replies, xml ) Need Help??


in reply to No Pause on Elsif in Debugger

Update: missed the point.

Its just following the control flow. Its not going to evaluate elsifs that it doesn't need to, because a prior condition passed. I think the rands in your statements are obscuring the issue.

if ( 1 ) { # debugger will see this, just like code } elsif ( 1 ) { # won't see this - nothing will } else { # nor this either }

qq


Comment on Re: No Pause on Elsif in Debugger
Download Code
Re^2: No Pause on Elsif in Debugger
by matija (Priest) on Jul 23, 2004 at 05:10 UTC
    Um, you're missing something, too. Take the code:
    if ( 0 ) { warn "a"; } elsif (1) { warn "b"; } else { warn "c"; }
    You will see this execution:
    main::(/tmp/foo:12): if ( 0 ) { DB<1> n main::(/tmp/foo:15): warn "b"; DB<1> n b at /tmp/foo line 15.
    So in an elsif chain, you always see just the first condition, not the first matching condition as your post states.

    20040725 Edit by ysth: correct <code> to </code>

Re^2: No Pause on Elsif in Debugger
by CountZero (Bishop) on Jul 23, 2004 at 15:06 UTC
    Attention: Could it not be that the optimizer simply "optimizes away" the code it can never reach? This would not happen with the "rand" statements.

    Anyhow it doen't matter as far as the debugger is concerned: the debugger only stops on "if"-part.

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://376749]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2014-12-27 20:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (177 votes), past polls