Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Source files, packages and name spaces

by Dinosaur (Beadle)
on Apr 15, 2002 at 16:11 UTC ( [id://159251]=note: print w/replies, xml ) Need Help??


in reply to Source files, packages and name spaces

Thanks for the replies, guys. Broquaint's example makes clear what the problem is. Code occurring outside of any sub just gets executed in sequence -- the package statement doesn't alter that sequence of execution.

Things which *do* alter that sequence include reordering the code (broquaint), forcing its early execution with BEGIN (merlyn), or pulling it in early with require (my initial example).

FWIW, I'd read about the $a/$b trap on previous visits here. Guess that sort of thing doesn't sink in until you get burned by actually doing it -- at least that's how I've learned just about everything else :(

--Dinosaur

  • Comment on Re: Source files, packages and name spaces

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (1)
As of 2024-04-25 00:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found