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

Re: where to use "use" and package

by elusion (Curate)
on Aug 01, 2002 at 03:31 UTC ( #186674=note: print w/replies, xml ) Need Help??


in reply to where to use "use" and package

The reason that you need to use the fully qualified name (File::Copy::copy(...)) is because by putting your use's before your package declaration, you've declared them into your main namespace.

Any time you're in a file and haven't declared the namespace with package, the namespace defaults to main. After your package declaration, you're in the Mods::Debug namespace.

So by putting the use's after the package declaration, you import them into the Mods::Debug namespace instead of main. This is the right way to do it.

elusion : http://matt.diephouse.com

Replies are listed 'Best First'.
Re: where to use "use" and package
by Abigail-II (Bishop) on Aug 01, 2002 at 09:29 UTC
    Case matters. The default package is called main, not Main.

    Abigail

Re: Re: where to use "use" and package
by smackdab (Pilgrim) on Aug 01, 2002 at 05:20 UTC
    Thanks, I didn't realize that each namespace would have to load in the *somewhat* "standard" modules. thanks !!!
      If the methods in a module were really standard, they wouldn't be in that module -- they'd be builtins

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (9)
As of 2019-07-16 16:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?