Old Skool Constants
package OldSkool::Constants; use strict; use warnings; use base 'Exporter'; use constant { MESSAGE => 'Hello World!', VOLUME => 11, TRUE => 1, FALSE => 0, }; our $VERSION = 1; our @EXPORT = qw( MESSAGE ); our @EXPORT_OK = qw( TRUE FALSE VOLUME ); our %EXPORT_TAGS = ( truth => [qw( TRUE FALSE )] );
Thus Spake Andy:
Here's an example of a module which defines some exportable constants
using the traditional Exporter
module. Notice the duplication of
TRUE
and FALSE
in @EXPORT_OK
and %EXPORT_TAGS
.