akujbida has asked for the wisdom of the Perl Monks concerning the following question:
$module_name isn't an object, so import does not apply to it. How to I get a handle on the relevant object upon which to call import? require just returns bool.#Somehow, we figure out the name of a module we need: $module_name = 'mymodule.pm'; #Then load it: eval 'require $module_name'; #And then try to make use of its vars and subs: $module_name->import(); #fails (of course)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: import() when require-d module name is variable
by chromatic (Archbishop) on Jul 18, 2009 at 17:54 UTC | |
|
Re: import() when require-d module name is variable
by shmem (Chancellor) on Jul 18, 2009 at 21:12 UTC | |
|
Re: import() when require-d module name is variable
by f00li5h (Chaplain) on Jul 18, 2009 at 22:15 UTC | |
|
Re: import() when require-d module name is variable
by CountZero (Bishop) on Jul 19, 2009 at 07:12 UTC |