Author: ericwilhelm
Date: Tue Sep 1 20:33:09 2009
New Revision: 13254
Modified:
Module-Build/trunk/lib/Module/Build/Base.pm
Log:
lib/Module/Build/Base.pm - initial code for installdeps
Modified: Module-Build/trunk/lib/Module/Build/Base.pm
==============================================================================
--- Module-Build/trunk/lib/Module/Build/Base.pm (original)
+++ Module-Build/trunk/lib/Module/Build/Base.pm Tue Sep 1 20:33:09 2009
@@ -850,6 +850,7 @@
__PACKAGE__->add_property(config => undef);
__PACKAGE__->add_property(test_file_exts => ['.t']);
__PACKAGE__->add_property(use_tap_harness => 0);
+__PACKAGE__->add_property(cpan_client => 'cpan');
__PACKAGE__->add_property(tap_harness_args => {});
__PACKAGE__->add_property(
'installdirs',
@@ -1752,6 +1753,7 @@
use_rcfile
use_tap_harness
tap_harness_args
+ cpan_client
); # normalize only selected option names
return $opt;
@@ -3154,6 +3156,33 @@
only::install::install(%onlyargs);
}
+sub ACTION_installdeps {
+ my ($self) = @_;
+
+ my $info = $self->_enum_prereqs or return;
+
+ my $failures = $self->prereq_failures($info) or return;
+
+ my @install;
+ while (my ($type, $prereqs) = each %$failures) {
+ warn $type;
+ if($type =~ m/_requires$/) {
+ push(@install, keys %$prereqs);
+ next;
+ }
+ while (my ($module, $status) = each %$prereqs) {
+ warn "$type $module $status->{message}\n";
+ push(@install, $module) if($self->y_n("install $module?", 'y'));
+ }
+ }
+
+
+ my ($command, @opts) = $self->split_like_shell($self->cpan_client);
+ # TODO possibly check whether $command is a perl script (search the
+ # PATH) and use run_perl_command().
+ $self->do_system($command, @opts, @install);
+}
+
sub ACTION_clean {
my ($self) = @_;
foreach my $item (map glob($_), $self->cleanup) {