Migrate to new perl with cpan autobundle發佈於：
This almost becomes a monthly task: How can I easily re-install all CPAN modules to my newly installed perl ?
Turns out one of the answers is to use our old friend
perl -MCPAN -eautobundle
This finds all installed modules and their distribution name, then stored these information in a snapshot file. When this is finished, the final messages shows:
Wrote bundle file /Users/gugod/.cpan/Bundle/Snapshot_2010_09_20_00.pm
Copy that line, Keep it for later. If you read that Snapshot pm file, it's just a list of names inside it's POD.
CPAN.pm has special knowledge to install a specially named
Now do a
perlbrew switch to your new perl, and run:
perl -MCPAN -e 'install Bundle::Snapshot_2010_09_20_00'
This should read the snapshot file and re-install everything listed in there.
To be honest, I personally had no idea what
autobundle means whatsoever until just now. This might not work with older perls with older builtin CPAN.pm. It feels like I should integrate part of it into perlbrew inself to make migration process easier.
Meanwhile I experimented a bit of
local::lib-based tool I called it cpan-sets, this helps to have multiple bundled snapshots at a time, while you can switch between them. This tool is written entirely in
bash for best results. I have no knowledge how to make it work for
t?csh users, please help.