Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^3: difference between packages and module

by AppleFritter (Vicar)
on Jun 27, 2014 at 21:03 UTC ( [id://1091513]=note: print w/replies, xml ) Need Help??


in reply to Re^2: difference between packages and module
in thread difference between packages and module

As best as I can tell this is actually a file named "Bar.pm" in a subdirectory named "Foo".

Same thing. The directory is considered to be part of the filename, really, as the distinction is often meaningless in practice, and files' actual names cannot contain forward slashes anyway, so there's no ambiguity.

Can this sort of thing go on to multiple levels? Like, could we have a module named "Utterly::Completely::Foo::Barred::Up" that would be defined in the "Up.pm" file located in the "Utterly/Completely/Foo/Barred" subdirectory (of a member of @INC, I guess)?

Yes. To give a random example from my system, App::Prove::State::Result::Test lives in a file named Test.pm in a (sub)directory called App/Prove/State/Result.

And, is that the only place where such a module could be found, or could it also be in a file of a different name and/or in a different subdirectory?

Yes, that's the only place where such a module could be found, though @INC may of course contain several places where Perl will look.

  • Comment on Re^3: difference between packages and module

Replies are listed 'Best First'.
Re^4: difference between packages and module
by Clovis_Sangrail (Beadle) on Jun 30, 2014 at 18:12 UTC

    When I read a phrase like "..module Foo::Bar would be in a file named Foo/Bar.pm" in the original (2006) discussion, and coming from a perspective of not already knowing Perl and trying to learn, it makes me think that maybe 'Foo/Bar.pm' is talking about some kind of internal-to-Perl thing, and not the Unix file system. I prefer to call 'Foo' part of the pathname.

    In any case, thanks for explaining. It is difficult, when you can work with Perl only sporadically, to distinguish between actual language syntax and customary usage. Now I feel like I have a better chance of understanding module calls.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (None)
    As of 2024-04-19 00:12 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found