Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Module's name and file's name

by aitap (Deacon)
on Jan 22, 2013 at 20:37 UTC ( #1014784=note: print w/ replies, xml ) Need Help??


in reply to Module's name and file's name

What exact problems do you have with these modules?

use just makes <ModuleName>.pm file from @INC be evaluated at the beginning of program (BEGIN{} block). <ModuleName>.pm can define any packages it wants to, but it's not a common way of writing modules.

So, if MyModule.pm contains this code:

package NotMyModule; sub function { 1 }
you can use its functions in your program by calling them by package names, not by the name of the file:
use MyModule; NotMyModule::function;

By the way, one file can define more than one package, thus making fatpacking modules in an application possible.

Sorry if my advice was wrong.


Comment on Re: Module's name and file's name
Select or Download Code
Replies are listed 'Best First'.
Re^2: Module's name and file's name
by beurive.denis (Novice) on Jan 22, 2013 at 20:53 UTC

    Hello Aitap,

    I just add a new message that describes the problem.

    But I have not many details to give. I though that the problem came from the naming convention... I did not look further.

    I'll look tomorrow, if I have some time.

    Regards

    Denis

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (19)
As of 2015-07-07 19:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls