Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

List all modules and versions used by a program

by tachyon-II (Chaplain)
on Apr 21, 2008 at 13:10 UTC ( #681911=snippet: print w/ replies, xml ) Need Help??

Description: Sometimes things break because code that worked with certain versions of modules does not work with others. This short block just dumps all the modules in use, with their version numbers when a script exits. By doing it in an END block you get a realistic picture of what got loaded and it will still print if your code dies for whatever reason.
END{ 
    no strict; # access $VERSION by symbolic reference
    print map {
        s!/!::!g; 
        s!.pm$!!; 
        sprintf "%-20s %s\n", $_, ${"${_}::VERSION"} 
    } sort keys %INC; 
};
Comment on List all modules and versions used by a program
Download Code
Re: List all modules and versions used by a program
by Fletch (Chancellor) on Apr 21, 2008 at 15:00 UTC

    Possibly also of interest would be Module::ScanDeps from CPAN (although that's more of a static analysis than after-the-fact diagnostic).

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

Re: List all modules and versions used by a program (Devel::Modlist)
by lodin (Hermit) on Apr 21, 2008 at 23:37 UTC

    There's also Devel::Modlist, used like

    perl -d:Modlist=options script.pl perl -MDevel::Modlist=options script.pl # equivalent
    which is handy as it doesn't require any modification of the program itself.

    lodin

Re: List all modules and versions used by a program
by Discipulus (Curate) on Apr 03, 2014 at 10:33 UTC
    take a look to this one too.

    HtH
    L*


    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Back to Snippets Section

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (11)
As of 2014-07-29 20:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (228 votes), past polls