How can I tell if a Perl module is actually used in my program? -


i have been on "cleaning spree" lately @ work, doing lot of touch-up stuff should have been done awhile ago. 1 thing have been doing deleted modules imported files , never used, or used @ 1 point not anymore. have been deleting import , running program's test file. gets really, really tedious.

is there programmatic way of doing this? short of me writing program myself it.

short answer, can't.

longer possibly more useful answer, won't find general purpose tool tell 100% certainty whether module you're purging used. may able build special purpose tool manual search you're doing on codebase. maybe try wrapper around test suite removes use statements , ignores error messages except messages undefined subroutine &__package__::foo , other messages occur when accessing missing features of module. wrapper automatically perform dumb source scan on codebase of module being purged see if missing subroutine foo (or other feature) might defined in unwanted module.

you can supplement devel::cover determine parts of code don't have tests can manually inspect areas , maybe insight whether using code module you're trying purge.

due halting problem can't statically determine whether program, of sufficient complexity, exit or not. applies problem because "last" instruction of program might 1 uses module you're purging. , since impossible determine last instruction is, or if ever executed, impossible statically determine if module used. further, in dynamic language, can extend program during it's run, analysis of source or post-compile symbol tables tell calling unwanted module before run-time (whatever means).

because of won't find general purpose tool works programs. however, if positive code doesn't use run-time features of perl might able write tool suited program can determine if code module you're purging executed.


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -