in reply to
How to export multiple packages in one file to another Perl program?
Thanks for all the replies.
I know about the MixedCase notation, I use it myself. The use of abstract variable names and uppercase was only to indicate it could be any class name or variable.
Let me rephrase the problem:
Let's say I have a OO package called MyFiles which maintains some sort of list of files and it supports 3 ways of sorting. $BY_SIZE, $BY_USER, $BY_DATE.
I could code 3 sort methods, or 1 sort method taking an extra parameter to indicate how it should be sorted. If I take the 2nd approach these constants have to be exported. I know how to do that using Exporter using EXPORT_OK, and I know I don't have to export any methods.
our @ISA = qw(Exporter);
our $BY_SIZE = 0;
our $BY_USER = 1;
our $BY_DATE = 3;
@EXPORT_OK = qw(
But I have multiple packages in one .pm file. And now I don't seem to be able to do this.
If you say it is bad practice to have 1 method, consider than an object that returns a specific error message number.
In that case also you would like to export the possible values of the error number as the programmer would be able to use that predefined value in his code rather than some vague number. In C you would put these values in a .h file.
Considering the replies it seems that everyone recommends seperate files for each package. Something I find cumbersome for distribution. But it seems I have no choice.