Problems? Is your data what you think it is? | |
PerlMonks |
Re: Possibly Stupid OOP questionby dsheroh (Monsignor) |
on Feb 27, 2008 at 04:06 UTC ( [id://670473]=note: print w/replies, xml ) | Need Help?? |
All classes are in the same monolithic source file. USE doesn't appear to like that and searches for actual .pm files...
That is correct. Since packages almost always have a one-to-one relationship with .pm files which share the same name, it's easy to start thinking of them as interchangable, but they're not. use specifies a file to read, no more and no less. The package(s) contained within that file are defined solely by the package statement(s) it contains. For example, if you have a file named Foo.pm containing then you would load its contents with use Foo, but execute them with Bar::hi. This is, obviously, a little confusing in most cases, which is why the convention of using the same name for the file and the package exists. But it's just a convention, not something enforced (or even recognized) by the language.
In Section
Seekers of Perl Wisdom
|
|