http://qs1969.pair.com?node_id=11134656

programmingzeal has asked for the wisdom of the Perl Monks concerning the following question:

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.