http://www.perlmonks.org?node_id=189502


in reply to Re: Re: test for subroutine existence
in thread test for subroutine existence

Okay, anyway -- now it seems pretty obvious:
print "my_sub ", test_for_sub("my_sub") ? "exists\n" : "doesn't exist\ +n"; print "no_sub ", test_for_sub("no_sub") ? "exists\n" : "doesn't exist\ +n"; sub test_for_sub { my ($expr) = @_; return eval "defined &$expr"; } sub my_sub { 1; }


--twerq