in reply to Re: Detect undefined subroutines
in thread Detect undefined subroutines

You could use

sub foo { ... } *foo->(...);
to receive compile-time warnings, assuming you don't use any other global datatype called foo (and doesn't try to call the same undefined subroutine twice).

Update: boldened "warnings" and added parenthesis.

ihb

Read argumentation in its context!

Replies are listed 'Best First'.
Re^3: Detect undefined subroutines
by tilly (Archbishop) on Sep 18, 2004 at 17:51 UTC
    Interesting idea, but it doesn't seem to work.
    tilly@(none):~$ perl -ce 'use strict; *foo->()' -e syntax OK tilly@(none):~$ perl -e 'use strict; *foo->()' Undefined subroutine &main::foo called at -e line 1.
    Tested with Perl 5.8.4.

    UPDATE I see, my oversight.

      You need to turn on warning to see them...

      $ perl -Mstrict -cwe '*foo->()' Name "main::foo" used only once: possible typo at -e line 1. -e syntax OK $ perl -Mstrict -we '*foo->()' Name "main::foo" used only once: possible typo at -e line 1. Undefined subroutine &main::foo called at -e line 1.

      ihb

      Read argumentation in its context!