in reply to How can I create a Bundle quickly and easily?

In general, this will be hard, since you would have to parse Perl to recognize all the statements where additional code is included (do, require, use, even open file and string eval are possible). ActiveState's PerlApp application has the same problem, and they need an "add this module" switch for you to add modules manually in the more pathological cases (dynamic require, e.g., in Tk).

It is hard to tell if you could do a quick-and-dirty hack for just your purposes. Depends both on your coding conventions, and on the install procedure you prefer (from CPAN automatically via CPAN shell, or from downloaded tarballs by a procedure that you wrote yourself (warning: there can be dependencies between modules, and you will have to handle them yourself)).

I would probably create a checklist of modules from the code relying on conventions (just use "use", etc.), build a CPAN bundle by first using autobundle and then tuning that by hand, create a checklist from that bundle, too, and diff both checklists. If there is something new, I will know and can handle it manually (just add to the bundle).

Christian Lemburg
Brainbench MVP for Perl
http://www.brainbench.com

  • Comment on Re: How can I create a Bundle quickly and easily?

Replies are listed 'Best First'.
Re: Re: How can I create a Bundle quickly and easily?
by snafu (Chaplain) on Jul 27, 2001 at 21:53 UTC
    I am not familiar with autobundle. Where can I read about that? Are there any words of wisdom you can give me on it?

    ----------
    - Jim

      From perldoc CPAN (read it):

      autobundle `autobundle' writes a bundle file into the `$CPAN::Config- >{cpan_home}/Bundle' directory. The file contains a list of all modules that are both available from CPAN and currently installed within @INC. The name of the bundle file is based on the current date and a counter.

      You can invoke it by saying:

      >perl -MCPAN -e autobundle

      It then starts to print out all the modules on your system, and put them into a bundle file:

      CPAN: LWP::UserAgent loaded ok [... bla bla bla ...] Package namespace installed latest in CPAN file AnyDBM_File undef undef G/GS/GSAR/perl-5.6.1.ta +r.gz [... many such lines ...] uri 1.04 undef L/LD/LDACHARY/URIC-2.02 +.tar.gz vars undef undef G/GS/GSAR/perl-5.6.1.ta +r.gz Wrote bundle file D:\home\.cpan\Bundle\Snapshot_2001_07_30_00.pm

      Now you have a bundle file that you can edit to your needs. Note that the order of appearance of modules matters, so you might need to tune your bundle file to your needs. That's how the bundle file autobundle created looks like:

      package Bundle::Snapshot_2001_07_30_00; $VERSION = '0.01'; 1; __END__ =head1 NAME Bundle::Snapshot_2001_07_30_00 - Snapshot of installation on on Mon J +ul 30 10:11:15 2001 =head1 SYNOPSIS perl -MCPAN -e 'install Bundle::Snapshot_2001_07_30_00' =head1 CONTENTS AnyDBM_File undef AppConfig 1.52 [... many such lines ...] [... NOTE: these are the lines you want to edit ...] subs undef uri 1.04 vars undef =head1 CONFIGURATION [... bla bla bla ...] =head1 AUTHOR This Bundle has been generated automatically by the autobundle routine + in CPAN.pm.

      Christian Lemburg
      Brainbench MVP for Perl
      http://www.brainbench.com