prevent a couple of porting test issues under PERL_UNICODE
authorTony Cook <tony@develop-help.com>
Fri, 14 Jun 2013 11:15:08 +0000 (21:15 +1000)
committerTony Cook <tony@develop-help.com>
Fri, 14 Jun 2013 11:15:27 +0000 (21:15 +1000)
cmpVERSION.pl: get_file_from_git() was returning a character string
which was then passed to MM->parse_version(), implicitly using
PerlIO::scalar to parse the content.

test_bootstrap.t complains since some of the test files aren't valid
UTF-8.

Porting/cmpVERSION.pl
t/porting/test_bootstrap.t

index 525ffe1..5300b87 100755 (executable)
@@ -192,6 +192,8 @@ foreach my $pm_file (sort keys %module_diffs) {
 sub get_file_from_git {
     my ($file, $tag) = @_;
     local $/;
+
+    use open IN => ':raw';
     return scalar `git --no-pager show $tag:$file 2>$null`;
 }
 
index 654eaac..df10b4c 100644 (file)
@@ -30,6 +30,8 @@ while (my $file = <$fh>) {
 
     local $/;
     open my $t, '<', $file or die "Can't open $file: $!";
+    # avoid PERL_UNICODE causing us to read non-UTF-8 files as UTF-8
+    binmode $t;
     my $contents = <$t>;
     # Make sure that we don't match ourselves
     unlike($contents, qr/use\s+Test::More/, "$file doesn't use Test::\QMore");