Author: dagolden
Date: Sun Aug 30 16:46:07 2009
New Revision: 13236

Modified:
   Module-Build/trunk/Changes
   Module-Build/trunk/lib/Module/Build/PPMMaker.pm
   Module-Build/trunk/lib/Module/Build/YAML.pm

Log:
guard against setting utf8 when utf8 isn't available

Modified: Module-Build/trunk/Changes
==============================================================================
--- Module-Build/trunk/Changes  (original)
+++ Module-Build/trunk/Changes  Sun Aug 30 16:46:07 2009
@@ -13,6 +13,7 @@
  Bug fixes:
  - Fix the t/destinations.t fix. [David Golden, with thanks to Eric Wilhelm]
  - Fix recursive test files in generated Makefile.PL (RT#49254) [Sawyer X]
+ - Guard against trying :utf8 when :utf8 isn't available
 
 0.35 - Thu Aug 27 09:12:02 EDT 2009
 

Modified: Module-Build/trunk/lib/Module/Build/PPMMaker.pm
==============================================================================
--- Module-Build/trunk/lib/Module/Build/PPMMaker.pm     (original)
+++ Module-Build/trunk/lib/Module/Build/PPMMaker.pm     Sun Aug 30 16:46:07 2009
@@ -1,6 +1,7 @@
 package Module::Build::PPMMaker;
 
 use strict;
+use Config;
 use vars qw($VERSION);
 $VERSION = '0.35_01';
 $VERSION = eval $VERSION;
@@ -113,7 +114,9 @@
   my $ppd_file = "$dist{name}.ppd";
   my $fh = IO::File->new(">$ppd_file")
     or die "Cannot write to $ppd_file: $!";
-  $fh->binmode(":utf8") if $fh->can("binmode");
+  
+  $fh->binmode(":utf8") 
+    if $fh->can('binmode') && $] >= 5.008 && $Config{useperlio};
   print $fh $ppd;
   close $fh;
 

Modified: Module-Build/trunk/lib/Module/Build/YAML.pm
==============================================================================
--- Module-Build/trunk/lib/Module/Build/YAML.pm (original)
+++ Module-Build/trunk/lib/Module/Build/YAML.pm Sun Aug 30 16:46:07 2009
@@ -1,6 +1,7 @@
 package Module::Build::YAML;
 
 use strict;
+use Config;
 use vars qw($VERSION @EXPORT @EXPORT_OK);
 $VERSION = "0.50";
 @EXPORT = ();
@@ -40,7 +41,7 @@
     }
     open my $OUT, "$mode $filename"
       or die "Can't open $filename for writing: $!";
-    binmode($OUT, ':utf8') if $] >= 5.008;
+    binmode($OUT, ':utf8') if $] >= 5.008 && $Config{useperlio};
     print $OUT Dump(@_);
     close $OUT;
 }
@@ -51,7 +52,7 @@
     my $filename = shift;
     open my $IN, $filename
       or die "Can't open $filename for reading: $!";
-    binmode($IN, ':utf8') if $] >= 5.008;
+    binmode($IN, ':utf8') if $] >= 5.008 && $Config{useperlio};
     return Load(do { local $/; <$IN> });
     close $IN;
 }

Reply via email to