Module::Used, Module::ScanDeps, Module::Extract::Use et al., Devel::TraceUse can all be useful in listing what modules you instructed perl to use (as opposed to what modules are "usefully used" which is what you want).
I assume the difficult bit will be to find a way to remove each of these modules from source in order to see the effect on compilation (as you suggested in a comment below). Removing from source code (e.g. with regex) can be trickier than finding them. Because finding them usually involves reading the %INC and I am not sure whether removing from %INC will have any effect at all.
One thing that comes to my mind, totally untested, is: instead of removing a module from source code and run, just prepend a dir in @INC which will contain "fake" module files (with empty content, bar the boilerplate). For example:
mkdir -p fakemodules/Data echo "package Data::Dumper;1;" > fakemodules/Data/Dumper.pm # this will fail: perl -Ifakemodules -MData::Dumper -e'print Data::Dumper::Dumper([1])' a=$? # this succeeds: perl -MData::Dumper -e'print Data::Dumper::Dumper([1])' b=$? if [ $a -ne 0 ] && [ $b -eq 0 ]; then echo "module is required"; fi
1 minute edit: I think choroba mentioned a similar technique for mocking modules and probably this is where I got it from
bw, bliako
In reply to Re: Removing unused Perl modules
by bliako
in thread Removing unused Perl modules
by no longer just digit
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |