I had the same issue as well. I wrote a class (attached) to encapsulate
references to routines via the name so that I could lazy-load them (this
is useful for template systems to avoid loading every possible tag
implementation every time). The logic tries to load the package for the
symbol if n
The easiest way is to call prototype. It dies if the
function doesn't exist.
sub function_exists {
eval { prototype $_[0] };
return ! $@
}
if ( function_exists("whatever") ) {
...
}
> [EMAIL PROTECTED] wrote:
>
> : I am writing a perl code which automatically forms a
> : function name
# perl -wle 'sub aaa{print 1}; exists &main::aaa and print "yes"' yes# perl -wle 'sub aaa{print 1}; exists &main::aab and print "yes"' # -- David L Nicol"For every thousand hacking away
at the leaves of evil, there is onestriking at the root." -- Thoreau.
___
> I am writing a perl code which automatically forms a function name using
> certain
> criteria and then calls the same
>
> I have a run time error reporting function not existing, if the function as
> such
> did not exist
> But I would like the execution to continue searching for other functi
[EMAIL PROTECTED] wrote:
: I am writing a perl code which automatically forms a
: function name using certain criteria and then calls the
: same
It would probably be safer to use a hash table for that.
: I tired using the following code
: doesnt seem to work
:
: my $func = \&TEST3;
: if (!
[EMAIL PROTECTED] wrote:
> Hi
> I am writing a perl code which automatically forms a function name using
> certain criteria and then calls the same
>
> I have a run time error reporting function not existing, if the function
> as such did not exist
> But I would like the execution to continue se
Hi
I am writing a perl code which automatically forms
a function name using certain criteria and then calls the same
I have a run time error reporting function not
existing, if the function as such did not exist
But I would like the execution to continue
searching for other functions
So, is