srd has asked for the wisdom of the Perl Monks concerning the following question:
my $module_name = sprintf "Plugin::",$plugin_name; eval "require $module_name"; die if $@; $module_name->import(); print "Plugin $module_name describes its purpose as:\n"; #syntax problem in the following line print $module_name->description, "\n";
$module_name->description obviously tries to invoke a subroutine called description in the relevant package.
$$module_name->description or ${$module_name}->description would act as if $module_name was a ref.
I'm a bit at a loss here. What would the correct syntax be? (Is there a correct syntax, or would I be forced to interact with the plugins through routines?)
Thanks in advance!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Accessing variables in a runtime-loaded module
by brian_d_foy (Abbot) on Jun 09, 2005 at 13:06 UTC | |
by srd (Initiate) on Jun 09, 2005 at 13:19 UTC | |
by rev_1318 (Chaplain) on Jun 09, 2005 at 14:22 UTC | |
by brian_d_foy (Abbot) on Jun 09, 2005 at 17:10 UTC | |
Re: Accessing variables in a runtime-loaded module
by splinky (Hermit) on Jun 09, 2005 at 13:31 UTC | |
by srd (Initiate) on Jun 09, 2005 at 13:39 UTC | |
Re: Accessing variables in a runtime-loaded module
by Samy_rio (Vicar) on Jun 09, 2005 at 14:12 UTC | |
by srd (Initiate) on Jun 09, 2005 at 18:29 UTC |