in reply to variables / consts for different scripts

package My::Constants; use strict; use warnings; use Exporter; our (@ISA, @EXPORT); @ISA = qw /Exporter/; @EXPORT = qw /$CONNECT $DB $KEYFILES @FILES/; our $CONNECT = 'DBI:mysql'; our $DB = 'SUN'; our $KEYFILE = 'key.csv'; our @FILES = '<*.csv>'; 1;

And then in your scripts, you'd do use My::Constants.

Be aware, the code above is untested.

Abigail

Replies are listed 'Best First'.
Re: Re: variables / consts for different scripts
by Skeeve (Parson) on Aug 28, 2003 at 09:06 UTC
    Sorry, but it didn't work.

    I read perldoc perlmod and from that everything in your example seems okay, except that I used Constants instead of My::Constants.

    I tried perl -e 'use strict; use Constants; print $DB' and get an "Global symbol "$DB" requires explicit package name at -e line 1" :-(

    I'm using perl 5.8.0

    I found my mistake. Your example is perfectly right and I shouldn't use "My::Constants" in the package name when I name it "Constants" everywhere else.

    Thanks for your help!