skerr1 has asked for the wisdom of the Perl Monks concerning the following question:
Depending on what a user specifies, I want to include different perl modules (e.g. foo.pm bar.mk etc). I only want to include them if they haven't already been inclulded. So I may have a variable $module that contains the module specified. I want to do something like:
if (!defined(%$module::)) { eval { require "${module}.pm"; } }
Of course the above code doesn't work. Can someone help with this? Thanks,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: check symbol table w/ dynamic name
by jwkrahn (Abbot) on Oct 17, 2006 at 04:32 UTC | |
by skerr1 (Sexton) on Oct 17, 2006 at 04:47 UTC | |
by jwkrahn (Abbot) on Oct 17, 2006 at 04:51 UTC | |
by skerr1 (Sexton) on Oct 17, 2006 at 05:17 UTC | |
by ammon (Sexton) on Oct 17, 2006 at 18:52 UTC | |
|
Re: check symbol table w/ dynamic name
by ikegami (Patriarch) on Oct 17, 2006 at 05:15 UTC | |
|
Re: check symbol table w/ dynamic name
by skerr1 (Sexton) on Oct 17, 2006 at 04:20 UTC |