in reply to Re^2: Detecting undefined subroutines at compile time
in thread Detecting undefined subroutines at compile time

just found that B::Xref lists sub-calls and(!) sub-definitions:
perl -MO=Xref tst.pl |grep foo tst.pl syntax OK &foo s1 &foo &1, &4 Subroutine foo

so just needing to parse¹ and compare the output.

But I agree that the dynamic nature of Perl makes such static parsing look strange.

Cheers Rolf

1) especially the raw output could be easily processed:

$ perl -MO=Xref,-r tst.pl |grep foo tst.pl (definitions) 1 main & foo + subdef tst.pl syntax OK tst.pl (main) 1 main & foo + subused tst.pl (main) 4 main & foo + subused tst.pl foo 3 main $ _ + used $ cat tst.pl foo(); sub foo { print } foo();