<?xml version="1.0" encoding="windows-1252"?>
<node id="794480" title="Re: When you change Perl versions, how do you resync all the CPAN modules you have installed [tag://sysadmin,cpan,modules,upgrade]" created="2009-09-09 21:46:13" updated="2009-09-09 21:46:13">
<type id="11">
note</type>
<author id="414875">
snoopy</author>
<data>
<field name="doctext">
At all times, I maintain a [mod://Module::Build]'s OO interface to produce a report of required modules. This can be used in any situation where I need to rebuild/upgrade/recover in a hurry.
&lt;p&gt;
For example:
&lt;code&gt;
#!/usr/bin/perl
use common::sense;
use Module::Build;
use Sys::Hostname qw/hostname/;

my $build = Module::Build-&gt;new
(
 module_name =&gt; 'DLS',
 license  =&gt; 'perl',
 requires =&gt; {
     'perl'            =&gt; '5.8.0',

     'CGI'	       =&gt; '3.11',
     'ACME::EyeDrops'  =&gt; '1.23',
 },

 dist_version =&gt; 0.1,
);

print "CPAN Dependencies for ".hostname()."\n";
print "=============================================\n";
print $build-&gt;prereq_report;
&lt;/code&gt;
Then on my target machine:
&lt;code&gt;
snoopy@snoopy-laptop:~$ perl cpan_deps.pl 2&gt;/dev/null
Checking prerequisites...
CPAN Dependencies for snoopy-laptop
=====================================

requires:
    Module              Need     Have
    -----------------+---------+----------
  ! ACME::EyeDrops      1.23      &lt;none&gt;
    CGI                 3.11      3.42
    perl                5.8.0     5.10.0

&lt;/code&gt;</field>
<field name="root_node">
650603</field>
<field name="parent_node">
650603</field>
</data>
</node>
