Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re^2: Perl best practices fanatism

by perrin (Chancellor)
on Dec 09, 2007 at 02:34 UTC ( #655917=note: print w/ replies, xml ) Need Help??

in reply to Re: Perl best practices fanatism
in thread Perl best practices fanatism

It's Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations. I remember because I requested it. I've never heard of this exception for local though. What's the story?

Comment on Re^2: Perl best practices fanatism
Replies are listed 'Best First'.
Re^3: Perl best practices fanatism
by chromatic (Archbishop) on Dec 09, 2007 at 06:15 UTC

    I have testing code (Parrot::Test, for example) that sometimes needs to mark a test as TODO, but for various reasons can't set the appropriate package variable. In the case of Parrot, this is because the code being tested is not Perl. Thus the library contains a line something like:

    local ${ $package . '::TODO' } = $opts{todo} if $opts{todo};

    This construct is very different than the conditional declaration of a lexical variable because local only controls the visibility of a symbol's binding. The unbinding always occurs at the end of the scope if the conditional is true. Unlike lexical bindings, the false condition does not interfere with unbinding.

    xdg is right, and it does appear fixed. Nice!

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (9)
As of 2015-11-27 13:52 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (729 votes), past polls