Brad.Walker has asked for the wisdom of the Perl Monks concerning the following question:
Specifically, I'm trying to get a reference to a function that might not exist in a Perl package. I know that I can use the Exporter module to probably make this work, but I've invested some time into trying to figure this out and would like to see if I can make it work.
What I have is:
But, I keep getting $ref set to a value even though f_preferred is not defined. What I would like is for it to return "undef" in this case.eval { no strict "refs"; require "$fqn_file"; local $SIG{'__DIE__'}; $ref = \&{$foo . "::f_preferred"}; }; warn $@ if $@;
Any help is much appreciated..
-brad w.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: referring to packages indirectly
by BrowserUk (Patriarch) on Oct 11, 2006 at 15:07 UTC | |
by ikegami (Patriarch) on Oct 11, 2006 at 15:28 UTC | |
|
Re: referring to packages indirectly
by cephas (Pilgrim) on Oct 11, 2006 at 15:29 UTC | |
|
Re: referring to packages indirectly
by kwaping (Priest) on Oct 11, 2006 at 15:26 UTC | |
by chromatic (Archbishop) on Oct 11, 2006 at 23:39 UTC |