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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
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:
Outside of code tags, you may need to use entities for some characters:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||