Allo, all. I'm not really sure how to write this, so I'm just going to try to get it out.

Currently, a bundle is just a lot of metadata. CPAN.pm knows what to do with the metadata: it gets the modules that the bundle consists of (hereafter referred to as submodules), and builds them.

However, this doesn't work very well if you aren't using CPAN.pm. You try to get the module by hand, do the perl Makefile.PL, make, make test, make install dance, and it happily installs the placeholder pod.

So I wrote a Makefile.PL that simply distributes actions across all of the subdirectories. To make a bundle this way, you just untar all the submodules into one directory, add extra files (README, META.yml, etc) in as you wish, and tar it up.

The biggest limitation is that there's no obvious method to install things that are part of the bundle itself and not one of the submodules. But that's OK, just add another subdirectory for that. The other limitation is that there can be no extra directores that are not submodules.

The code follows. Note that I'd love a better way to get a "real" $^X, that is, a full path by which we can call the current perl intrepter. I don't consider Config.pm to be a better way, though.

#!/usr/bin/perl use IO::File; use File::Spec 'catfile'; use warnings; use strict; # Alternative: Use Config's idea of the path to perl. # IMHO, it's entirely too easy to move the perl executable without upd +ating # Config.pm. We assume the user knew what they were doing when they s +pecified what # perl to run to the shell, and simply attempt to interpret it the sam +e way as the # shell did, when it's not absolute. my ($myperl)=(scalar(()=File::Spec->splitdir($^X)) > 1 # If the path h +as any "slash"es... # Assume it's rel to the current directory, or absolute ? File::Spec->rel2abs($^X) # Otherwise, we have very little to go on. Get the # first executable file Of this name in the path. : ( grep { -x $_ } # On unix, empty=. let this go for other OSes too, as # there's no other useful meaning. map { File::Spec->catfile($_, $^X) } (File::Spec->rel2a +bs($^X)), File::Spec->path ) ); print "Running with perl $myperl\n"; my $returnval=0; my @dirs = grep {-d $_} glob('*'); foreach (@dirs) { print "$_\n"; chdir $_ or do {print "Couldn't change directory to $_: $!"; next} +; system($^X, 'Makefile.PL', @ARGV); if ($?==-1) { print "Error running Makefile.PL: $!\n"; } elsif ($?) { print "While running Makefile.PL in subdir $_, it failed with +\$?=$?. Continuing anyway.\n"; print "(Signal ", $?>>8, ")\n" if $?>>8 ; print "(Return ", $?&127, ")\n" if $?&127; print "(Core dumped)\n" if $?&128; if ($?>>8 > $returnval) { $returnval = $?>>8; } } chdir '..' or die "Couldn't chdir back to main directory: $!"; } print "Writing Makefile in this directory.\n"; my @targets = qw(FORCE all ci clean config dist distcheck distclean di +stdir disttest dynamic help install linkext makemakerdflt manifest manifypods met +afile ppd realclean shdist skipcheck static subdirs tardist test testdb unin +stall uutardist veryclean zipdist); my $makefile = IO::File->new('>Makefile') or die "Cannot open Makefile +: $!"; print $makefile <<"END_OF_MAKEFILE"; # This makefile generated by Build::Bundle::Really @targets: END_OF_MAKEFILE foreach (@dirs) { print $makefile "\tcd $_; make $@"; print $makefile "\n"; } exit $returnval;


Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).


In reply to Real bundles? by theorbtwo

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.