in reply to Possible to catch undefined sub at "compile" time?

use warnings; use strict; sub monk {} sub go { mink 123; }

Done.

It also wouldn't be hard to write a module to scan the symbol table for references to undefined subroutines after the main script finished compiling and right before it starts running. I believe diotalevi(?) already wrote a module to report references to undefined subroutines.

- tye        

Replies are listed 'Best First'.
Re^2: Possible to catch undefined sub at "compile" time? (two ways)
by diotalevi (Canon) on Oct 10, 2007 at 18:09 UTC

    I didn't write B::Lint. It comes with your perl.

    ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

      I guess diotalevi's solution is what I was looking for:

      > perl -MO=Lint -c mink.pl Nonexistant subroutine 'mink' called at mink.pl line 4 mink.pl syntax OK

      It's a pity that it doesn't work on Windows to add '-MO=Lint' in the shebang line.

      Thanks everyone for your help and/or entertaining suggestions.