http://qs321.pair.com?node_id=425333


in reply to Perl application packaging

This may be Intuitively Obvious To the Casual Perl Monk (IOTTCPM) but I thought I would point it out anyway. If you have already built things as perl packages (h2xs -XA packagename), you can create a Makefile.PL one level up from the packages to control them as a unit.

For example if I start out with a bunch of packages:

project/packages/A Makefile.PL A.pm /B Makefile.PL B.pm /C Makefile.PL C.pm
You can add a Makefile.PL in the packages directory to span all packages below that point:

use ExtUtils::MakeMaker; # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. WriteMakefile( NAME => 'MyProjectPackages', # One line description of the module. ABSTRACT => 'A description of the rollup', AUTHOR => 'osunderdog<brucelowther@mac.com>', # Used by 'make install' which copies files from INST_SCRIPT t +o this directory. VERSION => '0.01', );

Building this Makefile.PL produces the following output:

$perl Makefile.PL Checking if your kit is complete... Looks good Writing Makefile for A Checking if your kit is complete... Looks good Writing Makefile for B Checking if your kit is complete... Looks good Writing Makefile for C Writing Makefile for MyProjectPackages

You can even test everything. (If you have diligently written all your tests!)

$make test make[1]: Entering directory `/tmp/project/packages/A' make[1]: Leaving directory `/tmp/project/packages/A' make[1]: Entering directory `/tmp/project/packages/B' make[1]: Leaving directory `/tmp/project/packages/B' make[1]: Entering directory `/tmp/project/packages/C' make[1]: Leaving directory `/tmp/project/packages/C' make[1]: Entering directory `/tmp/project/packages/A' PERL_DL_NONLAZY=1 /nfs/mu/apps/perl/5.8.4/bin/perl "-MExtUtils::Comman +d::MM" "-e" "test_harness(0, '../blib/lib', '../blib/arch')" t/*.t t/1....ok All tests successful. Files=1, Tests=1, 1 wallclock secs ( 0.06 cusr + 0.01 csys = 0.07 C +PU) make[1]: Leaving directory `/tmp/project/packages/A' make[1]: Entering directory `/tmp/project/packages/B' PERL_DL_NONLAZY=1 /nfs/mu/apps/perl/5.8.4/bin/perl "-MExtUtils::Comman +d::MM" "-e" "test_harness(0, '../blib/lib', '../blib/arch')" t/*.t t/1....ok All tests successful. Files=1, Tests=1, 0 wallclock secs ( 0.04 cusr + 0.00 csys = 0.04 C +PU) make[1]: Leaving directory `/tmp/project/packages/B' make[1]: Entering directory `/tmp/project/packages/C' PERL_DL_NONLAZY=1 /nfs/mu/apps/perl/5.8.4/bin/perl "-MExtUtils::Comman +d::MM" "-e" "test_harness(0, '../blib/lib', '../blib/arch')" t/*.t t/1....ok All tests successful. Files=1, Tests=1, 0 wallclock secs ( 0.04 cusr + 0.01 csys = 0.05 C +PU) make[1]: Leaving directory `/tmp/project/packages/C'

Finally, in answer to your question, you can roll up a distribution:

$make manifest /usr/bin/perl "-MExtUtils::Manifest=mkmanifest" -e mkmanifestAdded to +MANIFEST: A/A.pm Added to MANIFEST: A/Changes Added to MANIFEST: A/Makefile.PL Added to MANIFEST: A/MANIFEST Added to MANIFEST: A/README Added to MANIFEST: A/t/1.t Added to MANIFEST: B/B.pm Added to MANIFEST: B/Changes Added to MANIFEST: B/Makefile.PL Added to MANIFEST: B/MANIFEST Added to MANIFEST: B/README Added to MANIFEST: B/t/1.t Added to MANIFEST: C/C.pm Added to MANIFEST: C/Changes Added to MANIFEST: C/Makefile.PL Added to MANIFEST: C/MANIFEST Added to MANIFEST: C/README Added to MANIFEST: C/t/1.t Added to MANIFEST: Makefile.PL Added to MANIFEST: MANIFEST Added to MANIFEST: META.yml $make dist Generating META.yml Adding META.yml to MANIFEST rm -rf MyProjectPackages-0.01 /usr/bin/perl "-MExtUtils::Manifest=manicopy,maniread" \ -e "manicopy(maniread(),'MyProjectPackages-0.01', 'best');" mkdir MyProjectPackages-0.01 mkdir MyProjectPackages-0.01/B mkdir MyProjectPackages-0.01/A mkdir MyProjectPackages-0.01/B/t mkdir MyProjectPackages-0.01/C mkdir MyProjectPackages-0.01/C/t mkdir MyProjectPackages-0.01/A/t tar cvf MyProjectPackages-0.01.tar MyProjectPackages-0.01 MyProjectPackages-0.01/ MyProjectPackages-0.01/B/ MyProjectPackages-0.01/B/Changes MyProjectPackages-0.01/B/t/ MyProjectPackages-0.01/B/t/1.t MyProjectPackages-0.01/B/MANIFEST MyProjectPackages-0.01/B/B.pm MyProjectPackages-0.01/B/README MyProjectPackages-0.01/B/Makefile.PL MyProjectPackages-0.01/A/ MyProjectPackages-0.01/A/A.pm MyProjectPackages-0.01/A/Makefile.PL MyProjectPackages-0.01/A/Changes MyProjectPackages-0.01/A/MANIFEST MyProjectPackages-0.01/A/README MyProjectPackages-0.01/A/t/ MyProjectPackages-0.01/A/t/1.t MyProjectPackages-0.01/C/ MyProjectPackages-0.01/C/C.pm MyProjectPackages-0.01/C/Makefile.PL MyProjectPackages-0.01/C/Changes MyProjectPackages-0.01/C/README MyProjectPackages-0.01/C/t/ MyProjectPackages-0.01/C/t/1.t MyProjectPackages-0.01/C/MANIFEST MyProjectPackages-0.01/MANIFEST MyProjectPackages-0.01/META.yml MyProjectPackages-0.01/Makefile.PL rm -rf MyProjectPackages-0.01 gzip --best MyProjectPackages-0.01.tar

I find this to be a great way to develop a perl project consisting on many packages.


"Look, Shiny Things!" is not a better business strategy than compatibility and reuse.