in reply to Re^3: Can't import constants in multiple namespaces
in thread Can't import constants in multiple namespaces
The user of DBIx::MyMod doesDBIx::MyMod DBIx::MyMod::db DBIx::MyMod::st
use DBIx::MyMod qw(MYMOD_CONSTANT); # connect in the root my $h = DBIx::MyMod->connect(x,y, {XXX => MYMOD_CONSTANT});
I override connect in DBIx::MyMod and other DBI methods in DBIx::MyMod::db and DBIx::MyMod::st. I want to define and export the constants in DBIx::MyMod but still use them in DBIx::MyMod::db. I believe this would be equivalent to your fred.pl and the previous MyMod example doing:
andfred.pl use MyMod; # assuming all constants in EXPORT MyMod::db->fred();
use strict; use warnings; package MyMod; use MyMod::db; use constant MYMOD_DEFAULT => 1; use base qw (Exporter); our @EXPORT = qw(MYMOD_DEFAULT); 1;
use strict; use warnings; package MyMod::db; use MyMod; sub fred { print "hello" if (MYMOD_DEFAULT); } 1;
Do you know if it is possible to make that work?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Can't import constants in multiple namespaces
by mje (Curate) on Mar 28, 2006 at 16:13 UTC | |
|
Re^5: Can't import constants in multiple namespaces
by xdg (Monsignor) on Mar 28, 2006 at 16:43 UTC | |
by mje (Curate) on Mar 28, 2006 at 16:50 UTC |