Subject: | Fix for Net::Telnet sabotaging IO handles in perl 5.10 |
Hello,
The compatibility for ancient perls in supporting both IO::Handle and Filehandle causes filehandles to be broken in 5.10.1 unless you explicitly pull in Filehandle.pm.
The attached patch fixes this by removing this compatibility, as pre 5.6 perls are unlikely to be of interest these days.
I have pushed a development release to get feedback from CPAN Testers, http://matrix.cpantesters.org/?dist=Net-Telnet+3.04_01
I have also created a git repository containing this and a POD fix which you may pull from, https://repo.or.cz/Net-Telnet.git
Best regards,
Dave
Subject: | io.diff |
commit fb801ca53ad5028203c27a29b05a16c436d18906
Author: Dave Lambley <dave@lambley.me.uk>
Date: Mon Feb 17 13:05:08 2020 +0000
Avoid breaking IO::Handle methods in Perl 5.10.1
From perl5120delta, "Filehandles are now always blessed into IO::File."
IO::Socket::INET was added to core in 5.6.0, so we should be able to
rely on it being present.
diff --git a/ChangeLog b/ChangeLog
index 3950fc9..7cb88ed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,5 @@
+ * Break ancient perl compatibility, fix 5.10.1.
+
2013-04-21 Jay Rogers <jay@rgrs.com>
* Version 3.04 released.
diff --git a/Makefile.PL b/Makefile.PL
index 490b47d..3eb0171 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1,10 +1,22 @@
## -*- Perl -*-
+use v5.6;
use ExtUtils::MakeMaker qw(WriteMakefile);
WriteMakefile(NAME => "Net::Telnet",
DISTNAME => "Net-Telnet",
VERSION_FROM => "lib/Net/Telnet.pm",
+ PREREQ_PM => {
+ "IO::Handle" => 0,
+ "IO::Socket::INET" => 0,
+ "Socket" => 0,
+ "Symbol" => 0,
+ "parent" => 0,
+ },
+ TEST_REQUIRES => {
+ "Test::More" => 0,
+ "Test::Exception" => 0,
+ },
dist => { COMPRESS => "gzip", SUFFIX => "gz" },
($] >= 5.005 ?
(ABSTRACT => "Interact with TELNET port or other TCP ports",
diff --git a/lib/Net/Telnet.pm b/lib/Net/Telnet.pm
index f0f20fb..eb9b3df 100644
--- a/lib/Net/Telnet.pm
+++ b/lib/Net/Telnet.pm
@@ -29,20 +29,15 @@ use vars qw(@EXPORT_OK);
TELOPT_EXOPL);
## Module import.
+use IO::Socket::INET;
+use IO::Handle;
use Exporter ();
use Socket qw(AF_INET SOCK_STREAM inet_aton sockaddr_in);
use Symbol qw(qualify);
## Base classes.
-use vars qw(@ISA);
-@ISA = qw(Exporter);
-if (&_io_socket_include) { # successfully required module IO::Socket
- push @ISA, "IO::Socket::INET";
-}
-else { # perl version < 5.004
- require FileHandle;
- push @ISA, "FileHandle";
-}
+use parent qw/ Exporter IO::Socket::INET /;
+
my $AF_INET6 = &_import_af_inet6();
my $AF_UNSPEC = &_import_af_unspec() || 0;
my $AI_ADDRCONFIG = &_import_ai_addrconfig() || 0;
@@ -3311,13 +3306,7 @@ sub _negotiate_recv_enable {
sub _new_handle {
- if ($INC{"IO/Handle.pm"}) {
- return IO::Handle->new;
- }
- else {
- require FileHandle;
- return FileHandle->new;
- }
+ return IO::Handle->new;
} # end sub _new_handle
diff --git a/t/eat-filehandle.t b/t/eat-filehandle.t
new file mode 100644
index 0000000..07c21b0
--- /dev/null
+++ b/t/eat-filehandle.t
@@ -0,0 +1,13 @@
+#!/usr/bin/env perl
+
+use Test::More;
+use Test::Exception;
+use Net::Telnet;
+use IO::Handle;
+
+
+open(my $fh, "<", "/dev/zero") or die $!;
+
+lives_ok { $fh->untaint };
+
+done_testing();