I maintain the perl distribution Locale-Codes, and when I took over it, I inherited a number practices that I maintain for backward compatibility.
One of the things that the modules do is that they export a number of perl constants that can be used to specify exactly what code set you want to work with. So, when working with languages, the language module includes:
use Locale::Codes::Constants; our(@ISA,@EXPORT); @ISA = qw(Exporter); @EXPORT = qw(LOCALE_LANG_ALPHA_2);
I just added an object-oriented interface to the distribution, and I want to be able to specify the code set in the methods by using the constants (to be as similar to the traditional functions as possible).
I added the above lines to the OO module, and everything worked as desired, so I could just go ahead and leave it there, but it seems a bit wrong to export stuff in an OO module where typically everything is available via. a method.
Nothing is exported except for the constants, so is this generally considered an acceptable practice? Is there a better (i.e. more OO way) to make the constants available?
In reply to Exporter in an OO module? by SBECK
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |