in reply to How do I detect what modules are not being used?

I am grateful that you guys did not come up with a easy solution. This means I am not over-looking something obvious (a problem shared...)

Because these scripts reach-out and touch production files/databases, a solution that requires running the script is not a happy one.

The ultimate goal would be a "lint" type of check for each perl script that can be run when the script is submitted for production release. There is also the problem of having .. 5 different Linux servers without identical perl modules installed. My boss that wants the ability to know if a script working on machine A can be moved to machine C. This means identifying the real required modules and perhaps documenting them, but not trusting the "use" statements at the top of each script.

I hoped I could comment out all "use xxxx" statements and run "perl -c" or "perl -Mdiagnostics" and get a list of all the un-resolved function calls. This would at least get me started.

But.. un-resolved function calls generate run-time errors. (grrr). Any thoughts?

Replies are listed 'Best First'.
Re: Thank you for the thoughts
by Eyck (Priest) on Apr 07, 2005 at 17:28 UTC
    Take a look at PAR, they are solving a similar problem (OTOH, when you say 'use STH' they just assume it's because you need it), but still, they had a problem of figuring out which modules a given script might need, but still the problem is similar.

    OTOH, PAR might solve your problem of ensuring that given script will run on another machine - you can either pack your script, together with all it's requirements into .par archive, or even pack it into elf executable ( but that tends to create 2-5 megabyte executables ).