I want to scan a code base to identify all instances of undefined subroutines that are not presently reachable.
As an example:
use strict;
use warnings;
my $flag = 0;
if ( $flag ) {
undefined_sub();
}
Observations
When
$flag
evaluates to true, the following warning is emitted:Undefined subroutine &main::undefined_sub called at - line 6
I don't want to rely on warnings issued at run-time to identify undefined subroutines
The
strict
andwarnings
pragmas don't help here.use strict 'subs'
has no effect.Even the following code snippet is silent
$ perl -Mstrict -we 'exit 0; undefined_sub()'