Re: To find if a function exists

2006-05-31 Thread Alan M. Carroll
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

RE: To find if a function exists

2006-05-31 Thread Mathieu Longtin
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

Re: To find if a function exists

2006-05-31 Thread David Nicol
# 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. ___

Re: To find if a function exists

2006-05-31 Thread Eric Amick
> 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

RE: To find if a function exists

2006-05-31 Thread Charles K. Clarkson
[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 (!

Re: To find if a function exists

2006-05-31 Thread $Bill Luebkert
[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

To find if a function exists

2006-05-31 Thread sasisekar.krish
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