Haim Ashkenazi wrote:

> Hi
>
> I'm writing a module to serve a script I'm writing and I was wondering if
> it's possible to add a constant to the @EXPORT array. I prefer not to use
> variables because these settings shouldn't be changed, but I want every
> script that uses this module to be able to access these constants.
>
> I read somewhere that you can declare your constants like this:
> *BLAH = \"blah blah";
> and then export $BLAH.
>
> I tested it and it works, but I wanted to know if that's a good way of doing
> it, or there's a better one in terms of speed and memory usage.
>
> thanx
> --
> Haim

Try:

package MyConstants;

use strict;
use warnings;

use constant GREETING => 'Hello';
use constant NAME     => 'World';

use Exporter;

our @ISA = ('Exporter');
our @EXPORT = qw(GREETING NAME);

my $exultation = 'done';

*****************************

Greetings! E:\d_drive\perlStuff>perl -w -MMyConstants
print GREETING, ', ', NAME, "\n";
^Z
Hello, World

HTH,

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to