In perl.git, the branch blead has been updated

<https://perl5.git.perl.org/perl.git/commitdiff/82b53111b29b7b8060044482d261a31ccd5ac001?hp=1e420d1cde740938fdfedb4ce5d184e0e29eb093>

- Log -----------------------------------------------------------------
commit 82b53111b29b7b8060044482d261a31ccd5ac001
Author: James E Keenan <[email protected]>
Date:   Fri May 24 22:37:40 2019 -0400

    Prevent hostname() from accepting arguments
    
    Previously deprecated; now fatal.
    
    Incorporate feedback from Tony Cook and Richard Leach as to wording of
    exception and how it is invoked.
    
    For: RT 134137

-----------------------------------------------------------------------

Summary of changes:
 ext/Sys-Hostname/Hostname.pm  |  4 ++--
 ext/Sys-Hostname/t/Hostname.t | 19 +++++++------------
 2 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/ext/Sys-Hostname/Hostname.pm b/ext/Sys-Hostname/Hostname.pm
index 8b5dde1445..2284e1f81c 100644
--- a/ext/Sys-Hostname/Hostname.pm
+++ b/ext/Sys-Hostname/Hostname.pm
@@ -16,7 +16,7 @@ use warnings ();
 our $host;
 
 BEGIN {
-    $VERSION = '1.22';
+    $VERSION = '1.23';
     {
        local $SIG{__DIE__};
        eval {
@@ -29,7 +29,7 @@ BEGIN {
 
 
 sub hostname {
-  @_ and warnings::warnif("deprecated", "hostname() doesn't accept any 
arguments. This will become fatal in Perl 5.32");
+  @_ and croak("hostname() does not accepts arguments (it used to silently 
discard any provided)");
 
   # method 1 - we already know it
   return $host if defined $host;
diff --git a/ext/Sys-Hostname/t/Hostname.t b/ext/Sys-Hostname/t/Hostname.t
index a8c259d7c9..99f9e562c7 100644
--- a/ext/Sys-Hostname/t/Hostname.t
+++ b/ext/Sys-Hostname/t/Hostname.t
@@ -10,7 +10,7 @@ BEGIN {
 
 use Sys::Hostname;
 
-use Test::More tests => 4;
+use Test::More tests => 2;
 
 SKIP:
 {
@@ -23,15 +23,10 @@ SKIP:
 }
 
 {
-    use warnings;
-    my $warn;
-    local $SIG{__WARN__} = sub { $warn = "@_" };
-    eval { hostname("dummy") };
-    ok($warn, "warns with an argument");
-    like($warn, qr/hostname\(\) doesn't accept any arguments/,
-         "appropriate message");
-    no warnings "deprecated";
-    undef $warn;
-    eval { hostname("dummy") };
-    is($warn, undef, "no warning when disabled");
+    local $@;
+    eval { hostname("dummy"); };
+    like($@,
+        qr/hostname\(\) does not accepts arguments \(it used to silently 
discard any provided\)/,
+        "hostname no longer accepts arguments"
+    );
 }

-- 
Perl5 Master Repository

Reply via email to