Author: kwilliams
Date: Mon Feb 15 06:28:44 2010
New Revision: 13825

Modified:
   ExtUtils-CBuilder/trunk/Changes
   ExtUtils-CBuilder/trunk/lib/ExtUtils/CBuilder/Base.pm
   ExtUtils-CBuilder/trunk/t/01-basic.t

Log:
Fix include_dirs for string argument

Modified: ExtUtils-CBuilder/trunk/Changes
==============================================================================
--- ExtUtils-CBuilder/trunk/Changes     (original)
+++ ExtUtils-CBuilder/trunk/Changes     Mon Feb 15 06:28:44 2010
@@ -5,6 +5,10 @@
  Enhancements:
  - Added 'have_cplusplus()' method to check for C++ support
 
+ Bugs fixed:
+ - compile() now accepts both string & array for 'include_dirs'
+   argument, as documented.(RT#54606) [Alberto Sim�es]
+
 0.2603 - Sat Jul 18 06:56:06 EDT 2009
 
  Bugs fixed:

Modified: ExtUtils-CBuilder/trunk/lib/ExtUtils/CBuilder/Base.pm
==============================================================================
--- ExtUtils-CBuilder/trunk/lib/ExtUtils/CBuilder/Base.pm       (original)
+++ ExtUtils-CBuilder/trunk/lib/ExtUtils/CBuilder/Base.pm       Mon Feb 15 
06:28:44 2010
@@ -88,7 +88,9 @@
   my $cf = $self->{config}; # For convenience
 
   $args{object_file} ||= $self->object_file($args{source});
-  
+
+  $args{include_dirs} = [ $args{include_dirs} ] if exists($args{include_dirs}) 
&&
+                                                   ref($args{include_dirs}) ne 
"ARRAY";
   my @include_dirs = $self->arg_include_dirs
     (@{$args{include_dirs} || []},
      $self->perl_inc());

Modified: ExtUtils-CBuilder/trunk/t/01-basic.t
==============================================================================
--- ExtUtils-CBuilder/trunk/t/01-basic.t        (original)
+++ ExtUtils-CBuilder/trunk/t/01-basic.t        Mon Feb 15 06:28:44 2010
@@ -32,7 +32,7 @@
   plan skip_all => "no compiler available for testing";
 }
 else {
-  plan tests => 10;
+  plan tests => 12;
 }
 
 ok $b, "created EU::CB object";
@@ -79,3 +79,24 @@
   is( $words[0], 'foo' );
   is( $words[1], 'bar' );
 }
+
+# include_dirs should be settable as string or list
+{
+  package Sub;
+  use base 'ExtUtils::CBuilder';
+  my $saw = 0;
+  sub do_system {1}
+  sub arg_include_dirs {
+    $saw = 1 if grep {$_ eq 'another dir'} @_;
+  }
+
+  package main;
+  my $s = Sub->new();
+  $s->compile(source => 'foo',
+             include_dirs => 'another dir');
+  ok $saw;
+
+  $s->compile(source => 'foo',
+             include_dirs => ['a dir', 'another dir']);
+  ok $saw;
+}

Reply via email to