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;
In reply to Real bundles? by theorbtwo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |