Perl detects undeclared subs (which is better than detecting undefined subs) at compile-time if you omit parens on sub calls.
>perl -c -e"use strict; sub f {} f;" -e syntax OK >perl -c -e"use strict; sub f; f;" -e syntax OK >perl -c -e"use strict; f;" Bareword "f" not allowed while "strict subs" in use at -e line 1. -e had compilation errors. >perl -c -e"use strict; sub g {} g 'abc';" -e syntax OK >perl -c -e"use strict; g 'abc';" String found where operator expected at -e line 1, near "g 'abc'" (Do you need to predeclare g?) syntax error at -e line 1, near "g 'abc'" -e had compilation errors.
Omitting parens on sub calls causes a whole of weird stuff, so I recommend against doing this.
In reply to Re: Detecting undefined subroutines at compile time
by ikegami
in thread Detecting undefined subroutines at compile time
by bdenckla
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |