develooper Front page | perl.perl5.porters | Postings from June 2019

[perl #134137] Implement preventing Sys::Hostname::hostname() fromaccepting arguments

Thread Previous
From:
Tony Cook via RT
Date:
June 4, 2019 23:54
Subject:
[perl #134137] Implement preventing Sys::Hostname::hostname() fromaccepting arguments
Message ID:
rt-4.0.24-28234-1559692433-371.134137-15-0@perl.org
On Fri, 24 May 2019 19:48:35 -0700, jkeenan wrote:
> On Sat, 25 May 2019 01:56:12 GMT, jkeenan@pobox.com wrote:
> > pod/perldeprecation.pod contains this entry for perl-5.32:
> >
> > #####
> > hostname() doesn't accept any arguments
> >
> > The function
> > "hostname()" in the Sys::Hostname module has always been
> > documented to be called with no arguments. Historically it
> > has not enforced this, and has actually accepted and
> > ignored any arguments. As a result, some users have got the
> > mistaken impression that an argument does something useful.
> > To avoid these bugs, the function is being made strict.
> > Passing arguments was deprecated in Perl 5.28, and will
> > become fatal in Perl 5.32.
> > #####
> >
> > This entry was recorded in the following commit:
> >
> > #####
> > commit 0c9c439d08a65206d442724bcd9fb29fa5a7f937
> > Author: Zefram <zefram@fysh.org>
> > Date:   Wed Dec 6 16:28:18 2017 +0000
> >
> > document hostname(@args) deprecation
> >
> > Passing arguments to Sys::Hostname::hostname() is already
> > deprecated. Note the deprecation's agreed removal version
> > of Perl 5.32. Also document it in perldeprecation.pod.
> > #####
> >
> > Make it so.
> >
> > Thank you very much.
> > Jim Keenan
> 
> Please review patch attached (or smoke-me/jkeenan/rt-134137-hostname
> branch).
> 
> Thank you very much.

- @_ and warnings::warnif("deprecated", "hostname() doesn't accept any arguments. This will become fatal in Perl 5.32");
+ @_ and die("hostname() no longer accepts arguments"); 

Two issues:

- this should probably use croak() instead of die() so the error is produced at the caller

- Richard's point about the error message in 

https://www.nntp.perl.org/group/perl.perl5.porters/2019/05/msg254903.html

which didn't make it to the ticket.

Tony

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=134137

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About