Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Perl application packaging

by osunderdog (Deacon)
on Jan 26, 2005 at 18:56 UTC ( #425333=note: print w/ replies, xml ) Need Help??


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.


Comment on Re: Perl application packaging
Select or Download Code
Replies are listed 'Best First'.
Re^2: Perl application packaging
by bibliophile (Parson) on Jan 26, 2005 at 19:01 UTC
    Thanks, osunderdog! That is exactly what I was looking for :-)

    To all replies: ++ tomorrow, when I've got some points again :-)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://425333]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (13)
As of 2015-07-31 11:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (276 votes), past polls