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?
[karlgoethebier]: I'll take that right hand road...
[thezip]: Howdy y'all. Is it safe to just delete StrawberryPerl-> cpan->build directories?
[1nickt]: karlgoethebier Thank you!! How could I not have ever heard of this musician?
[choroba]: thezip should be ok.
[thezip]: It seemed so, choroba, but I don't want to confuse anyone (especially myself!)
[choroba]: thezip unless something like this happens to you.

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (10)
As of 2017-03-23 20:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (294 votes). Check out past polls.