mje has asked for the wisdom of the Perl Monks concerning the following question:
perl -cw MyMod.pmMyMod.pm ======== use strict; use warnings; package MyMod; use Exporter (); use vars qw (@EXPORT @EXPORT_OK); use constant MYMOD_DEFAULT => 1; BEGIN { @EXPORT = (); @EXPORT_OK = (MYMOD_DEFAULT); }; use MyMod::db; 1; MyMod/db.pm =========== use strict; use warnings; package MyMod::db; sub fred { print "hello" if (MYMOD_DEFAULT); } 1;
Bareword "MYMOD_DEFAULT" not allowed while "strict subs" in use at MyMod/db.pm line 5. Compilation failed in require at MyMod.pm line 12. BEGIN failed--compilation aborted at MyMod.pm line 12.
I saw the thread at http://www.perlmonks.org/?node_id=384405 and the answer by ysth sounded like it worked but I cannot make it work for me.
Hope you can help.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Can't import constants in multiple namespaces
by xdg (Monsignor) on Mar 28, 2006 at 12:16 UTC | |
by mje (Curate) on Mar 28, 2006 at 12:57 UTC | |
by xdg (Monsignor) on Mar 28, 2006 at 13:43 UTC | |
by mje (Curate) on Mar 28, 2006 at 14:53 UTC | |
by xdg (Monsignor) on Mar 28, 2006 at 16:43 UTC | |
| |
by mje (Curate) on Mar 28, 2006 at 16:13 UTC | |
|
Re: Can't import constants in multiple namespaces
by Joost (Canon) on Mar 28, 2006 at 12:07 UTC | |
by mje (Curate) on Mar 28, 2006 at 12:16 UTC | |
by xdg (Monsignor) on Mar 28, 2006 at 12:26 UTC |