Thread (26 messages) flat view 26 messages, 7 authors, 2016-11-08

Re: [PATCH 4/4] t0021: fix filehandle usage on older perl

From: Lars Schneider <hidden>
Date: 2016-11-06 14:55:05

quoted hunk ↗ jump to hunk
On 02 Nov 2016, at 19:23, Jeff King [off-list ref] wrote:

The rot13-filter.pl script calls methods on implicitly
defined filehandles (STDOUT, and the result of an open()
call).  Prior to perl 5.13, these methods are not
automatically loaded, and perl will complain with:

 Can't locate object method "flush" via package "IO::Handle"

Let's explicitly load IO::File (which inherits from
IO::Handle). That's more than we need for just "flush", but
matches what perl has done since:

 http://perl5.git.perl.org/perl.git/commit/15e6cdd91beb4cefae4b65e855d68cf64766965d

Signed-off-by: Jeff King <redacted>
---
I see J6t solved this a week ago using "FileHandle". These days that is
basically a compatibility synonym for IO::File. I think both should be
available pretty much everywhere, so I went with IO::File for the
reasons above. But if that doesn't work for some reason, switching to
"use FileHandle" should be OK, too.

I don't have an old enough perl easily available to test it either way.

t/t0021/rot13-filter.pl | 1 +
1 file changed, 1 insertion(+)
diff --git a/t/t0021/rot13-filter.pl b/t/t0021/rot13-filter.pl
index e3ea58e1e..4d5697ee5 100644
--- a/t/t0021/rot13-filter.pl
+++ b/t/t0021/rot13-filter.pl
@@ -21,6 +21,7 @@
use strict;
use warnings;
+use IO::File;

my $MAX_PACKET_CONTENT_SIZE = 65516;
my @capabilities            = @ARGV;
-- 
2.11.0.rc0.258.gf434c15
Looks good to me (and works flawlessly on newer macOS).

Thanks,
Lars
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help