B::LintSubs - Perl compiler backend to check sub linkage
perl -MO=LintSubs [FILE] [-e PROGRAM]
When using use strict, subroutine names are not checked at the callsite; this makes the following a perfectly valid program at compiletime, that only blows up at runtime
use strict
use strict; foobar();
When using the B::LintSubs checker instead, this is detected:
B::LintSubs
$ perl -MO=LintSubs -e 'use strict; foobar();' Undefined subroutine foobar called at -e line 2
Imported functions from other modules are of course detected:
$ perl -MO=LintSubs -e 'use strict; use List::Util qw( max ); $_ = max( 1, 2, 3 )' -e syntax OK
In order to handle situations where external code is conditionally referenced at runtime, any fully-qualified references to other functions are printed with a warning, but not considered fatal. The programmer is assumed to Know What He Is Doing in this case:
$ perl -MO=LintSubs -e 'if( 1 ) { require Data::Dumper; Data::Dumper::Dump( "Hello" ) }' Unable to check call to Data::Dumper::Dump in foreign package at -e line 1 -e syntax OK
Paul Evans <leonerd@leonerd.org.uk>
Based on the B::Lint module by Malcolm Beattie, <mbeattie@sable.ox.ac.uk>.
B::Lint
To install B::LintSubs, copy and paste the appropriate command in to your terminal.
cpanm
cpanm B::LintSubs
CPAN shell
perl -MCPAN -e shell install B::LintSubs
For more information on module installation, please visit the detailed CPAN module installation guide.