Re: [Module-build-general] PATCH: added ACTION_versioninstall
Status: Beta
Brought to you by:
kwilliams
From: Brian I. <in...@tt...> - 2003-02-24 02:20:37
|
On 19/02/03 20:43 -0600, Ken Williams wrote: > Applied! > > I think the fact that $only::config::versionlib, > $only::config::versionarch, and @ARGV need to be manipulated > dynamically means that only.pm needs a little interface work, though - > do you plan on adding a programmatic interface that could just accept > this stuff as arguments? And now for that patch I promised. Sorry I took so long, but you challenged me to go back and refactor only.pm, which I did a whole bunch of. I think you'll find the new patch to be much cleaner :) I also am getting some interesting ideas on how to give C<only> an OO API. Something like: use only YAML => '0.35'; could be: use only; my $o; BEGIN { $o = only->new; $o->module('YAML'); $o->condition('0.35'); $o->versionlib('/home/ingy/modules'); $o->include; # have object put itself into @INC } use YAML qw(:all); BEGIN { $o->exclude; # remove itself from @INC } Anyway, I digress. Here is your patch. I must admit I find it quite powerful to say: perl Build.PL ./Build versioninstall versionlib=/home/ingy/foo Cheers, Brian diff -ru Module-Build-0.15-orig/lib/Module/Build/Base.pm Module-Build-0.15.only/lib/Module/Build/Base.pm --- Module-Build-0.15-orig/lib/Module/Build/Base.pm Fri Jan 17 12:53:11 2003 +++ Module-Build-0.15.only/lib/Module/Build/Base.pm Sun Feb 23 17:56:55 2003 @@ -761,6 +761,14 @@ ExtUtils::Install::install($self->install_map('blib'), 1, 1); } +sub ACTION_versioninstall { + my ($self) = @_; + eval { require only::install }; + die "You must have only.pm installed for this operation:\n$@" if $@; + $self->depends_on('build'); + only::install::install(%{$self->{args}}); +} + sub ACTION_clean { my ($self) = @_; foreach my $item (keys %{$self->{cleanup}}) { diff -ru Module-Build-0.15-orig/lib/Module/Build.pm Module-Build-0.15.only/lib/Module/Build.pm --- Module-Build-0.15-orig/lib/Module/Build.pm Fri Jan 17 13:11:05 2003 +++ Module-Build-0.15.only/lib/Module/Build.pm Wed Feb 19 16:46:26 2003 @@ -733,6 +733,28 @@ anything, it will just report what it I<would> have done if you had actually run the C<install> action. +=item versioninstall + +If you have C<only.pm> installed on your system, you can use this action +to install a module into the version specific library trees. This means +that you can have several versions of the same module installed and +C<use> a specific one like this: + + use only MyModule => 0.55; + +To override the default installation libraries in C<only::config>, +specify the C<versionlib> parameter when you run the C<Build.PL> script: + + perl Build.PL versionlib=/my/version/place/ + +To override which version the module is installed as, specify the +C<versionlib> parameter when you run the C<Build.PL> script: + + perl Build.PL version=0.50 + +See the C<only.pm> documentation for more information on version +specific installs. + =item manifest This is an action intended for use by module authors, not people Only in Module-Build-0.15.only: x |