perl -wle 'if (0) {no_such_func()}'
The above runs without errors, despite the -w, because no_such_func() is never called.
How do I make Perl check all functions/modules I reference, even ones I don't use?
In a more realistic case, some functions may only be called in special cases, but I'd still like to make sure they exist.
EDIT: I installed perlcritic, but I think I'm still doing something wrong. I created this file:
#!/bin/perl -w
use strict;
if (0) {no_such_func();}
and perlcritic said it was fine ("source OK"). Surely static analysis could catch the non-existence of no_such_func()? The program also runs fine (and produces no output).