#################################################################### # sub # testFunction # # purpose # takes a module name and function name, returns true if the # function exists in the module # # syntax: testFunction("Mine::Module", "myFunction"); # sub testFunction { my ($modname, $funcname) = @_; my $pkgname = $modname.".pm"; $pkgname =~ s/\:\:/\//g; #this is UNIX Specific #we use eval to avoid requiring a pkg which doesn't exist eval ' no strict; require($pkgname); local *stash = *{ "${modname}::" }; return unless defined &{ $stash{$funcname} }; 1; '; }