twerq has asked for the wisdom of the Perl Monks concerning the following question:
my $sub_to_test = "test_sub"; # try to fire an EVAL_ERROR eval "$sub_to_test()"; # if no EVAL_ERROR if (!$@) { # do the thing eval "$sub_to_test ('testing, 1,2,3')"; } sub test_sub { return unless @_; print "TEST_SUB: $_[0]\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: test for subroutine existence
by Abigail-II (Bishop) on Aug 12, 2002 at 13:59 UTC | |
by twerq (Deacon) on Aug 12, 2002 at 14:20 UTC | |
by Abigail-II (Bishop) on Aug 12, 2002 at 14:32 UTC | |
by twerq (Deacon) on Aug 12, 2002 at 14:27 UTC | |
|
Re: test for subroutine existence
by fuzzyping (Chaplain) on Aug 12, 2002 at 14:02 UTC | |
|
Re: test for subroutine existence
by ehdonhon (Curate) on Aug 12, 2002 at 17:00 UTC | |
|
Re: Test for Subroutine Definition
by tadman (Prior) on Aug 15, 2002 at 07:42 UTC |