in reply to inheritance of constants
and your code should only import the constants. No need for inherence.package MyConstants; require 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;
use MyConstants qw/LOGIN PASS IP DB_NAME/; DBI->connect ("DBI:mysql:host=".IP.";database=".DB_NAME."", LOGIN, PAS +S,{PrintError => 0, RaiseError => 1})
|
|---|