Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Source-Code Analysis?

by fletcher_the_dog (Friar)
on May 17, 2004 at 22:05 UTC ( #354118=note: print w/replies, xml ) Need Help??


in reply to Source-Code Analysis?

Below is an example of little module I use for checking what modules are loaded at compile time by a script or module. It will not show you what modules are loaded at run time using 'require' though. You probably modify it to see if the modules being loaded are old ones you want to get rid of.
package Dependancies; =head1 NAME Dependancies =head1 SYNOPSIS perl -MDependancies -c <PERL FILE> =head1 DESCRIPTION This module is used to see what the dependancies a script or module ha +s at COMPILE time. =cut CHECK{ while (my($file,$location)=each(%INC)) { print "$file => $location\n"; } }; 1;

Replies are listed 'Best First'.
Re: Re: Source-Code Analysis?
by rjray (Chaplain) on May 17, 2004 at 23:21 UTC

    Not to toot my own horn too much, but I have a module on CPAN that does this: Devel::Modlist.

    It can also reduce the number of listings down, using the CPAN info, to only reference one module per distribution (much like the "r" command in the CPAN shell).

    --rjray

      Funny you should post this - I just used your module a couple days ago to find module dependencies so I can install a webapp in a standalone situation. And it did a great job in a very quick & easy way. :-)

      The downside: it missed one module. I'm using Class::DBI, and it missed the DBIx::ContextualFetch module used by Ima::DBI. But that seems forgivable since the only mention of DBIx::CF in Ima::DBI is in the RootClass attribute passed to DBI->connect. No use statement at all. Hmm, maybe I should submit a patch...

        That's odd. Were you, by chance, using the "stop" option to get a reading without actually running the application? Because one limitation it does have is that modules loaded dynamically at run-time don't show up during the initial compile phase. If you ran the application from start to end, I would think it would catch these extras.

        (The same thing would happen with plain-old DBI and any associated drivers.)

        --rjray

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://354118]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (1)
As of 2021-09-18 23:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?