Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Perl application packaging

by bibliophile (Prior)
on Jan 26, 2005 at 16:48 UTC ( [id://425270]=perlquestion: print w/replies, xml ) Need Help??

bibliophile has asked for the wisdom of the Perl Monks concerning the following question:

Esteemed monks,

I've been happily hacking away on a collection of modules that implement various bits and pieces of an application (eg: a database abstraction module, a data abstraction module, a handful of standalone utility scripts (and the modules they depend on), and a whack of Perl/Tk widgets), each with it's own test suite, etc.... plus of course the app script itself.

I'm getting to the point where I'd like to be able to install the whole collection in one fell swoop.

I've been looking at things like creating Bundles (from the CPAN FAQ) and/or PAR, though I'm not sure this is the correct way to go - this is new territory for me.

So the question(s): How do you handle building/distributing Perl applications? How about module build-order dependencies (eg: app::DB needs to be built after app::DB::PostgreSQL (or app::DB::MySQL, depending on what the user has installed))?
Would it make sense to build a "meta-module" that lists all of the above as dependencies?
Would it make sense to set up some kind of "local CPAN"-type thingy?

I'm not looking for hand-holding here... just a nudge in the right direction :-)

Thanks,

Replies are listed 'Best First'.
Re: Perl application packaging
by osunderdog (Deacon) on Jan 26, 2005 at 18:56 UTC

    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.

      Thanks, osunderdog! That is exactly what I was looking for :-)

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

Re: Perl application packaging
by Mutant (Priest) on Jan 26, 2005 at 16:53 UTC

    There's some discussion of this here.

      Interesting, thanks... I'm looking more for information/opinions on how to package up a Perl-based application, rather than how Perl itself is packaged (unless that's the same thing? As I said, new territory for me....)

      I'm assuming that the machine the app will be installed on already has Perl :-)

        Probably more intesting than the node I linked to above is the follow-ups (eg. this one for debian systems). There's good info on how to install specfic versions of CPAN modules.

        If you're more worried about your custom (non-CPAN) modues, then CVS or similar may be an option. Good use of tags and branches makes it easy to keep code consistent across multiple systems.

        But it really depends on:

        1. What platform you're running on.
        2. What you're deploying to (eg. servers, desktops, random users on the web)
        3. And maybe how you want to handle CPAN packages.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://425270]
Approved by Tanktalus
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (9)
As of 2024-03-28 12:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found