Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Code style advice: where to put "use" statements?

by Fletch (Chancellor)
on Feb 27, 2008 at 04:50 UTC ( #670485=note: print w/ replies, xml ) Need Help??


in reply to Code style advice: where to put "use" statements?

Since imports happen at a package level any symbols will still be available outside the sub in the same package, so that's not a reason to do it (just as an example why someone possibly might think they want to do it (in a misguided attempt to limit the scope of imports)).

I think I might have done it once or twice when it's a module that's only used in a single sub rather than throughout the code (so you stash it away in that sub rather than in the "global" list of includes at the start of your code), but other than that I'd be biased against it.

Update: Added extra parenthetical in parenthetical. And it looks like I'm not the only one that's done it for a "just used here" notation. Heh.

The cake is a lie.
The cake is a lie.
The cake is a lie.


Comment on Re: Code style advice: where to put "use" statements?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2014-12-28 20:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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





    Results (182 votes), past polls