Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

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

by Fletch (Bishop)
on Feb 27, 2008 at 04:50 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://670485]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-26 03:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found