One issue is this:
This script DOES use sshopen2, but not Ping or FTP.use Getopt::Long; use Net::SSH qw(sshopen2); use Net::Ping; use Net::FTP; ...
What could I do (from another perl script scanning through *.pl files) to report that this file includes but does not use Ping or FTP?
I have tried using >perl -MO=Xref,-d test.pl to generate a cross-reference list of variables, but this does not identify packages that are included, but not used.
I thought about taking test.pl and creating copies like "a.pl", "b.pl", "c.pl", "d.pl".. with the difference:
a.pl - comments out the "use Getopt::Long" line
b.pl - comments out the "use Net::SSH qw(sshopen2)" line ..
Then doing a perl -c on each copy to see if I could identify useless "use" statements if things tested correctly. But this does not catch things.
I tried using
perl -MO=Deparse test.pl
Hoping that this would expand:
&sshopen2() into
&NET::SSH::sshopen2()
And I could grep the expanded output to find the packages that ARE used and do my own bookeeping, but Deparse does not fully-qualify function calls.
So I am kind of stumpped. Any thoughts?
In reply to How do I detect what modules are not being used? by FatDog
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |