in reply to Use with variable
perldoc -f use tells you the following:
Imports some semantics into the current package from the named module, generally by aliasing certain subroutine or variable names into your package. It is exactly equivalent to
BEGIN { require Module; import Module LIST; }
except that Module *must* be a bareword.
So, you can easily do it like the following:
my $module = "CGI"; $module->require; $module->import;
Update: Fixed the ugly bug I introduced. Thanks to tomhukins for spotting it.
Update 2: I should test before I promise broken things as fixed. See my reply to edan further down
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Use with variable
by tomhukins (Curate) on Sep 08, 2004 at 13:18 UTC | |
|
Re^2: Use with variable
by edan (Curate) on Sep 08, 2004 at 13:34 UTC | |
by Corion (Patriarch) on Sep 08, 2004 at 13:39 UTC | |
by edan (Curate) on Sep 08, 2004 at 13:42 UTC | |
by Corion (Patriarch) on Sep 08, 2004 at 13:48 UTC | |
by edan (Curate) on Sep 08, 2004 at 14:15 UTC | |
by Anonymous Monk on Sep 08, 2004 at 14:43 UTC | |
|