Just another Perl shrine | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
You can defininitely have modules all in the same file. You can have modules across multiple files. You're just missing a few key ideas.
The first is that you don't need Exporter if you're doing OO or are in the same file. Exporter is if you want to make a repository of functions, then bring some of them into another file. If you're all in the same file and package, then everything has access to the right symbols. If you're doing OO, then just do a PACKAGE->new just like normal. use is only to compile another file which has a certain naming convention, and bring it into your namespace. If you have a class in your file, just work with it as if it had been in another file and you'd use'd it. The third is that you're not going back to the main package. You need to tell the interpreter where the first line to execute is. That's the first line in the main package. Try the following: That should work just fine. ------ Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement. In reply to Re: packages / modules in the same file
by dragonchild
|
|