Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
I am frequently confronted with re-installation of Strawberry Perl modules on Windows as ActiveState Perl is not available easily for installation, they have changed its installer download method. Every time I do fresh installation of strawberry Perl I have to install CPAN modules which often require dependency resolution which pose problem when certain dependency is not resolved particularly on windows. Also, simple copy paste of installed modules (.pm and .pl files/directories) from Strawberry Perl source directory to destination does not work and problems arise later on. I hit upon an idea. We know that in Strawberry distribution, the installation path of CPAN modules is 'C:\Strawberry\perl\site\lib' We can traverse a list of files (.pm and .pl) in above directory recursively along with file timestamp data (file creation date) and keep the list of installed .pm files chronologically saved. This way, whenever I have to do fresh Perl installation of CPAN modules I have the information that which module is required to be installed before other dependent module. The basic module installed on top of the list will be with no dependency and all such modules comes early in the list. All the modules with no dependency will come early in the list. Will my approach work or are there any workarounds of solving this issue of dependent modules installation. For getting list of installed CPAN modules along with .pm/.pl creation date time, I have developed the following code which is working:
use strict; use warnings; use Data::Dumper; use File::Find; my @file_list; my $directory = 'C:\Strawberry\perl\site\lib'; my ($file, $time, $ctime); find ( \&wanted, $directory ); sub wanted { return unless -f; return unless /\.(pl|pm)$/; $file = $File::Find::name; $ctime = (stat $File::Find::name)[10]; $time = scalar localtime($ctime); push (@file_list, [$file, $time]); } print Dumper @file_list;
I have about 3000 .pm and .pl files in my current Strawberry Perl Distribution which I am going to wipe-out.

In reply to Get List of installed CPAN modules with timestamp for CPAN modules dependency resolution by programmingzeal

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2022-12-06 16:22 GMT
Find Nodes?
    Voting Booth?

    No recent polls found