On 5/28/10 10:29 AM, David Golden wrote:
If you could please send me a new patch (or a git pull request), I'll
apply it to the repo.

How's this?  Inline /and/ attached.  :]

--- Module-Build-0.36_10/lib/Module/Build/Base.pm       2010-05-19 
17:39:41.000000000 -0500
+++ Module-Build-0.36_10-patch/lib/Module/Build/Base.pm 2010-05-31 
15:47:44.000000000 -0500
@@ -2697,7 +2697,22 @@
   local $Test::Harness::Switches    =
   local $ENV{HARNESS_PERL_SWITCHES} = "-MDevel::Cover";
- $self->depends_on('test');
+  my $orig_tap_harness_args = $self->tap_harness_args();
+  if ( $self->use_tap_harness() or $orig_tap_harness_args ) {
+    my %tap_harness_args = %{$orig_tap_harness_args || {}};
+    $tap_harness_args{switches} =
+      [ @{$tap_harness_args{switches} || []}, '-MDevel::Cover' ];
+    $self->tap_harness_args(\%tap_harness_args);
+  }
+
+  my $worked = eval {
+    $self->depends_on('test');
+    1;
+  };
+  my $error = $@;
+  $self->tap_harness_args($orig_tap_harness_args);
+  die $error if not $worked;
+
   $self->do_system('cover');
 }
diff -ru Module-Build-0.36_10/lib/Module/Build/Base.pm 
Module-Build-0.36_10-patch/lib/Module/Build/Base.pm
--- Module-Build-0.36_10/lib/Module/Build/Base.pm       2010-05-19 
17:39:41.000000000 -0500
+++ Module-Build-0.36_10-patch/lib/Module/Build/Base.pm 2010-05-31 
15:47:44.000000000 -0500
@@ -2697,7 +2697,22 @@
   local $Test::Harness::Switches    =
   local $ENV{HARNESS_PERL_SWITCHES} = "-MDevel::Cover";
 
-  $self->depends_on('test');
+  my $orig_tap_harness_args = $self->tap_harness_args();
+  if ( $self->use_tap_harness() or $orig_tap_harness_args ) {
+    my %tap_harness_args = %{$orig_tap_harness_args || {}};
+    $tap_harness_args{switches} =
+      [ @{$tap_harness_args{switches} || []}, '-MDevel::Cover' ];
+    $self->tap_harness_args(\%tap_harness_args);
+  }
+
+  my $worked = eval {
+    $self->depends_on('test');
+    1;
+  };
+  my $error = $@;
+  $self->tap_harness_args($orig_tap_harness_args);
+  die $error if not $worked;
+
   $self->do_system('cover');
 }
 

Reply via email to