SBECK has asked for the wisdom of the Perl Monks concerning the following question:
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?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Exporter in an OO module?
by ikegami (Patriarch) on Jan 04, 2017 at 16:08 UTC | |
by afoken (Chancellor) on Jan 05, 2017 at 05:14 UTC | |
Re: Exporter in an OO module?
by haukex (Archbishop) on Jan 04, 2017 at 15:54 UTC | |
by SBECK (Chaplain) on Jan 04, 2017 at 16:06 UTC | |
by haukex (Archbishop) on Jan 04, 2017 at 16:58 UTC | |
Re: Exporter in an OO module for CONSTANTS? Lexical?
by Anonymous Monk on Jan 05, 2017 at 01:32 UTC |