mat21 has asked for the wisdom of the Perl Monks concerning the following question:
Now, I would like to transfer these constants in another file (.pm) and reuse them.use constant LOGIN => 'name'; use constant PASS => 'pwd'; use constant IP => '190.xxx.xxx.xx'; use constant DB_NAME => 'mydbname';
then, in my script I tryiedpackage constant; use Exporter (); @ISA = qw (Exporter); @EXPORT_OK = qw ( LOGIN PASS IP DB_NAME); use constant LOGIN => 'name'; use constant PASS => 'pwd'; use constant IP => '190.xxx.xxx.xx'; use constant DB_NAME => 'mydbname'; 1;
but it doesn't work. constants are not recognized. I am not very familiar with inheritance.use constant; @ISA = qw (constant); ... DBI->connect ("DBI:mysql:host=".IP.";database=".DB_NAME."", LOGIN, PAS +S,{PrintError => 0, RaiseError => 1})
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: inheritance of constants
by BrowserUk (Patriarch) on Nov 24, 2004 at 10:21 UTC | |
|
Re: inheritance of constants
by borisz (Canon) on Nov 24, 2004 at 10:19 UTC | |
|
Why are you sharing constants in a module?
by rrwo (Friar) on Nov 24, 2004 at 11:35 UTC | |
|
Re: inheritance of constants
by fglock (Vicar) on Nov 24, 2004 at 13:33 UTC | |
|
Re: inheritance of constants
by mat21 (Beadle) on Nov 24, 2004 at 13:30 UTC | |
by Old_Gray_Bear (Bishop) on Nov 24, 2004 at 16:39 UTC |