Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Module's name and file's name

by aitap (Curate)
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 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.

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.



Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1014784]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2018-04-27 05:13 GMT
Find Nodes?
    Voting Booth?