in reply to how to export methods from module [only partially SOLVED]
LATER: ahh, it seems the .pm name and the package name have to be the same! Does that mean I have to put multiple packages in seperate modules??!?
No, and no. But: use does a lookup per file name. Inside a file, the package statement declares a name space. It is highly confusing if the file name and the name space name are not related, or chosen nilly-willy.
Remember that use Foo is (roughly) equivalent to
if (eval "require $package") { $package->import(@args); }
If your file is called mine.pm and you use that (use mine;), but inside that file there's a name space mypack established, the use attempts to call mine->import and not mypack->import. There is no facility in Exporter to check which name spaces have been set up by an imported file which wishes to export symbols.
As for your second question - you may set up multiple name spaces in one file, but only the name space which matches the file name will be handled correctly with Exporter.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: how to export methods from module [only partially SOLVED]
by Anonymous Monk on May 03, 2009 at 22:14 UTC |