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
package Bar;
use strict;
use warnings;
sub hi {
print "Hello, world!\n";
}
1;
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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
|
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.