> 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 there any way I can find out if there is a function that is already
> existing to make a decision to call
>
> I tired using the following code
> doesnt seem to work
>
> my $func = \&TEST3;
> if (! $func) {
> print "Function TEST3 does not exist\n";
> } else {
> print "TEST3 Function Exists\n";
> print &$func()." is return value\n";
> }
If it's a fixed function name, just use defined() directly:
if (!defined &XYZ) {
print "OOPS!\n"
}
If you construct the function name at run time, this should work. ($funcname
contains the function name.)
if (!eval "defined &$funcname") {
print "OOPS!\n"
}
--
Eric Amick
Columbia, MD
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs