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

Re: Module's name and file's name

by sundialsvc4 (Abbot)
on Jan 23, 2013 at 19:57 UTC ( #1015011=note: print w/replies, xml ) Need Help??


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

It is my understanding that the names should agree because Perl looks for module-files by matching the file name.   It reads whatever it finds, of course expecting that the desired package-name will be defined thereby.

However, the formal purpose of the package directive is to introduce a namespace, and once Perl has been cajoled into reading a source-file, it will of course recognize all of the package (namespace) names found therein.   Sometimes there are very good, even compelling, reasons to do just that ... for instance, when you are defining grammars for Parse::RecDescent (and I don’t know offhand if it is strictly necessary ...), or when you simply have a group of classes that you know will always be used together to help one another out.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1015011]
help
Chatterbox?
[Eily]: Clearly this needs some advanced JDWIMA (Just Do What I Mean Already!) magic
[Eily]: I hear perl 8 will even DWYM even when you're not really sure what you mean either

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (8)
As of 2017-09-20 15:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (237 votes). Check out past polls.

    Notices?