Going home for the holidays and installing perl on that basement computer? Well, whether you're heading up North or way down South, be sure to Bundle up! Both major "package managers", CPAN and CPANPLUS, support the Bundle convention which allows you to fill an order based on a shopping list of your favorite, or absolutely necessary, modules.
Simply create a module in the Bundle name-space with a special =CONTENTS pod section (lines 9-19), listing each module to install on its own line. Lines can optionally specify the version of the mod with optional minimum version1 (line 11), or comment following a dash (lines 13-17). Save it to a file in the @INC search path, or specified by -Mlib=2 and /CPAN(?:PLUS)?/ will work its magic and install all of the desired modules when we "install" this one.
Note that if our bundle were on CPAN, instead of created locally, it gets installed locally too. The fact that Bundles aren't discarded as mere metafiles allows for some minimal versioning of bundles, and other parlor tricks. For instance, if you create your ToolSet as a Bundle, the POD provides documentation of its purpose, while providing a simple means of assembling your mise en place.
Unsure what modules to include in a Bundle? If you use one of the perl package managers listed, try perldoc perllocal for a list of distributions installed in site_perl. If you have too many "favorite" modules to list, and would prefer to "replicate"1 environment? Use cpan -a or cpanp -b to "autobundle"; the latter resulted in a null file for the author though. Be warned: both commands are slow, especially CPAN, however with it not only do you get a complete inventory, you also get information about the availability of newer and shinier versions. Either way, you can now take your Bundle/Snapshot_*.pm with you and have all the comforts of your $HOME $ENV at your fingertips!
Package namespace installed latest in CPAN file
Algorithm::C3 0.07 0.07 BLBLACK/Algorithm-C3-0.07.tar.gz
Algorithm::Diff 1.1902 1.1902 TYEMQ/Algorithm-Diff-1.1902.tar.gz
AnyData 0.10 0.10 JZUCKER/AnyData-0.10.tar.gz
…
vmsish 1.02 1.02 RGARCIA/perl-5.10.0.tar.gz
warnings 1.05 1.06 RGARCIA/perl-5.10.0.tar.gz
Wrote bundle file
/home/me/.cpan/Bundle/Snapshot_2008_12_10_00.pm
1 package Bundle::mod10; 2 our $VERSION = '0.25'; 3 1; 4 5 __END__ 6 7 =pod 8 9 =head1 CONTENTS 10 11 Date::Christmas 1.01 12 13 Business::CreditCard - Don't leave home with out it! 14 15 WWW::Scraper::NorthernLight - oooh ... aaaahhhh 16 17 Acme::Drunk - Who's bringing the eggnog? 18 19 =cut
1. Alas, CPAN doesn't install the specified version of a module, so it is not possible to exactly replicate an environment bug-for-bug/feature-for-feature with Bundles.
2. Inclusion of a trailing slash is important e.g; -Mlib=./ and not -Mlib=.
2008-12-12: ToolSet::Bundle has been created to facilitate the hypothetical use of Bundles with ToolSet mentioned above.