On Sun, 24 Sep 2017 18:17:07 GMT, jkeenan wrote: > On Fri, 22 Sep 2017 21:13:47 GMT, slaven@rezic.de wrote: > > > > This is a bug report for perl from slaven@rezic.de, > > generated with the help of perlbug 1.40 running under perl 5.27.4. > > > > > > ----------------------------------------------------------------- > > The POSIX Pod says for localtime: > > > > This is identical to Perl's builtin "localtime()" function for > > converting seconds since the epoch to a date see "localtime" in > > perlfunc. > > > > However, it is only identical if the optional argument is given --- > > POSIX::localtime fails if the argument is missing: > > > > $ perl5.27.4 -MPOSIX -e 'warn localtime(time); warn > > POSIX::localtime(time)' > > 5982322811752641 at -e line 1. > > 5982322811752641 at -e line 1. > > > > $ perl5.27.4 -MPOSIX -e 'warn localtime(); warn POSIX::localtime()' > > 2292322811752641 at -e line 1. > > Usage: POSIX::localtime(time) at -e line 1. > > > > This seems to be the case since 5.8.x, at least (checked with 5.8.8). > > > > I would expect that the documentation is adjusted, or that > > POSIX::localtime > > may deal with a missing argument. > > > > > > This is a problem more general than simply POSIX::localtime(). I > suspect it affects all POSIX::*() functions which claim to be > identical to the Perl builtins of the same name and which, in core, > work with an implicit $_. The POSIX::* functions appear to require an > explicit argument. > > This makes sense to me because the POSIX specifications don't have the > equivalent of our topic variable. > > I grepped the CPAN POSIX documentation for those functions which are > claimed to work the same in both places. See attachment 132145-posix- > identical-to-perl.txt. > > I then began to write a test file comparing the builtins and the POSIX > variants, with and without explicit arguments. See attachment 132145- > core-vs-posix.t. (This test file should be extended to all functions > named in the other attachment.) > > I think that we should simply change the documentation as needed to > indicate this one difference in behaviour between builtins and POSIX. > > Thank you very much. Partially done in commit bda53d3ed47d5776c4a1b88c0b7cfb484f5644be. -- James E Keenan (jkeenan@cpan.org) --- via perlbug: queue: perl5 status: open https://rt.perl.org/Ticket/Display.html?id=132145