diff -Nurd Encode-ISO2022-0.04.orig/ISO2022/Makefile.PL Encode-ISO2022-0.04/ISO2022/Makefile.PL --- Encode-ISO2022-0.04.orig/ISO2022/Makefile.PL 2013-09-19 11:38:58.000000000 -0400 +++ Encode-ISO2022-0.04/ISO2022/Makefile.PL 2018-06-23 18:45:33.000000000 -0400 @@ -28,6 +28,9 @@ } my ($enc2xs, $encode_h) = ('enc2xs', '.'); +if (-r $ENV{ENC2XS}) { + $enc2xs = $ENV{ENC2XS} +} else { my @path_ext = (''); @path_ext = split(';', $ENV{PATHEXT}) if $^O eq 'MSWin32'; PATHLOOP: @@ -41,19 +44,16 @@ } } } +} $enc2xs or die "enc2xs not found!"; print "enc2xs is $enc2xs\n"; -my %encode_h = (); for my $d (@INC) { my $dir = File::Spec->catfile($d, "Encode"); my $file = File::Spec->catfile($dir, "encode.h"); - -f $file and $encode_h{$dir} = -M $file; + -f $file and $encode_h = $dir and last; } -%encode_h or die "encode.h not found!"; - -# find the latest one -($encode_h) = sort { $encode_h{$b} <=> $encode_h{$a} } keys %encode_h; +$encode_h or die "encode.h not found!"; print "encode.h is at $encode_h\n"; my $name = 'ISO2022'; diff -Nurd Encode-ISO2022-0.04.orig/ISOIRSingle/Makefile.PL Encode-ISO2022-0.04/ISOIRSingle/Makefile.PL --- Encode-ISO2022-0.04.orig/ISOIRSingle/Makefile.PL 2013-09-19 11:39:18.000000000 -0400 +++ Encode-ISO2022-0.04/ISOIRSingle/Makefile.PL 2018-06-23 18:45:34.000000000 -0400 @@ -32,6 +32,9 @@ } my ($enc2xs, $encode_h) = ('enc2xs', '.'); +if (-r $ENV{ENC2XS}) { + $enc2xs = $ENV{ENC2XS} +} else { my @path_ext = (''); @path_ext = split(';', $ENV{PATHEXT}) if $^O eq 'MSWin32'; PATHLOOP: @@ -45,19 +48,16 @@ } } } +} $enc2xs or die "enc2xs not found!"; print "enc2xs is $enc2xs\n"; -my %encode_h = (); for my $d (@INC) { my $dir = File::Spec->catfile($d, "Encode"); my $file = File::Spec->catfile($dir, "encode.h"); - -f $file and $encode_h{$dir} = -M $file; + -f $file and $encode_h = $dir and last; } -%encode_h or die "encode.h not found!"; - -# find the latest one -($encode_h) = sort { $encode_h{$b} <=> $encode_h{$a} } keys %encode_h; +$encode_h or die "encode.h not found!"; print "encode.h is at $encode_h\n"; my $name = 'ISOIRSingle'; diff -Nurd Encode-ISO2022-0.04.orig/JISLegacy/Makefile.PL Encode-ISO2022-0.04/JISLegacy/Makefile.PL --- Encode-ISO2022-0.04.orig/JISLegacy/Makefile.PL 2018-06-23 18:44:01.000000000 -0400 +++ Encode-ISO2022-0.04/JISLegacy/Makefile.PL 2018-06-23 18:45:00.000000000 -0400 @@ -28,6 +28,9 @@ } my ($enc2xs, $encode_h) = ('enc2xs', '.'); +if (-r $ENV{ENC2XS}) { + $enc2xs = $ENV{ENC2XS} +} else { my @path_ext = (''); @path_ext = split(';', $ENV{PATHEXT}) if $^O eq 'MSWin32'; PATHLOOP: @@ -41,19 +44,16 @@ } } } +} $enc2xs or die "enc2xs not found!"; print "enc2xs is $enc2xs\n"; -my %encode_h = (); for my $d (@INC) { my $dir = File::Spec->catfile($d, "Encode"); my $file = File::Spec->catfile($dir, "encode.h"); - -f $file and $encode_h{$dir} = -M $file; + -f $file and $encode_h = $dir and last; } -%encode_h or die "encode.h not found!"; - -# find the latest one -($encode_h) = sort { $encode_h{$b} <=> $encode_h{$a} } keys %encode_h; +$encode_h or die "encode.h not found!"; print "encode.h is at $encode_h\n"; my $name = 'JISLegacy';