New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
POSIX::localtime not identical to CORE::localtime #16163
Comments
From @eserteThis is a bug report for perl from slaven@rezic.de, The POSIX Pod says for localtime: This is identical to Perl's builtin "localtime()" function for However, it is only identical if the optional argument is given --- $ perl5.27.4 -MPOSIX -e 'warn localtime(time); warn POSIX::localtime(time)' $ perl5.27.4 -MPOSIX -e 'warn localtime(); warn POSIX::localtime()' 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 Flags: This perlbug was built using Perl 5.20.2 - Sat Jun 3 12:27:58 UTC 2017 Site configuration information for perl 5.27.4: Configured by eserte at Thu Sep 21 00:25:50 CEST 2017. Summary of my perl5 (revision 5 version 27 subversion 4) configuration: @INC for perl 5.27.4: Environment for perl 5.27.4: |
From @jkeenanOn Fri, 22 Sep 2017 21:13:47 GMT, slaven@rezic.de wrote:
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. |
From @jkeenan# perl my $val; { { local $@; $_ = $val; local $@; { { { my $homedir = $ENV{HOME}; chdir($tdir) or croak "Unable to change to a different starting directory"; chdir($tdir) or croak "Unable to change to a different starting directory"; is($bdir, $adir, "chdir and POSIX::chdir match when each is provided with a value"); chdir($tdir) or croak "Unable to change to a different starting directory"; { { chmod 0644, $tfile1, $tfile2; { { $_ = $val; |
From @jkeenan information on most features. Consult perlfunc for functions which are "abs" This is identical to Perl's builtin "abs()" function, returning "alarm" This is identical to Perl's builtin "alarm()" function, either for "atan2" This is identical to Perl's builtin "atan2()" function, returning "chdir" This is identical to Perl's builtin "chdir()" function, allowing "chmod" This is identical to Perl's builtin "chmod()" function, allowing "chown" This is identical to Perl's builtin "chown()" function, allowing "cos" This is identical to Perl's builtin "cos()" function, for "exit" This is identical to Perl's builtin "exit()" function for exiting "exp" This is identical to Perl's builtin "exp()" function for returning "fabs" This is identical to Perl's builtin "abs()" function for returning "fcntl" This is identical to Perl's builtin "fcntl()" function, see "fork" This is identical to Perl's builtin "fork()" function for "getc" This is identical to Perl's builtin "getc()" function, see "getc" "kill" This is identical to Perl's builtin "kill()" function for sending "link" This is identical to Perl's builtin "link()" function for creating "log" This is identical to Perl's builtin "log()" function, returning "mkdir" This is identical to Perl's builtin "mkdir()" function for "rmdir" This is identical to Perl's builtin "rmdir()" function for "sin" This is identical to Perl's builtin "sin()" function for returning "sleep" This is functionally identical to Perl's builtin "sleep()" "sqrt" This is identical to Perl's builtin "sqrt()" function. for "stat" This is identical to Perl's builtin "stat()" function for "time" This is identical to Perl's builtin "time()" function for "umask" This is identical to Perl's builtin "umask()" function for setting "utime" This is identical to Perl's builtin "utime()" function for "wait" This is identical to Perl's builtin "wait()" function, see "wait" |
The RT System itself - Status changed from 'new' to 'open' |
From @cpansproutOn Sun, 24 Sep 2017 11:17:07 -0700, jkeenan wrote:
I agree. -- Father Chrysostomos |
From @xsawyerxOn 09/24/2017 10:21 PM, Father Chrysostomos via RT wrote:
I agree as well. |
From @jkeenanOn Mon, 25 Sep 2017 10:37:31 GMT, xsawyerx@gmail.com wrote:
So here is a plan. 1. We should work through the list of POSIX::* functions cited in attachment https://rt-archive.perl.org/perl5/Ticket/Attachment/1493177/804012/132145-posix-identical-to-perl.txt, updating the documentation to indicate how the POSIX function differs from the core function. 2. Where necessary, we should add tests which demonstrate that difference. I say "where necessary" because it turns out that the fact that some POSIX::* functions fail if provided 0 arguments is already tested in ext/POSIX/t/usage.t. ##### 3. I'll start this off with the case of 'POSIX::localtime', since that was the original concern of this RT. Documentation updated in commit dc41635. 4. Since there are quite a few POSIX::* functions whose documentation needs to be patched, we can do this in small batches. Anyone who hasn't had a commit to the core distribution recently (or ever) is encouraged to pick one of the remaining functions and write a documentation + test patch along the lines of mine for 'localtime' (assuming people don't have objections to that patch). Thank you very much. -- |
From solutions@overmeer.net* James E Keenan via RT (perlbug-followup@perl.org) [170926 13:03]:
Do you know about this manual page: It started off with my rewrite of the POSIX.pm manual page, which never Mark Overmeer MSc MARKOV Solutions |
From solutions@overmeer.net=head1 NAME POSIX - Perl interface to IEEE Std 1003.1 =head1 SYNOPSIS use POSIX (); printf "EINTR is %d\n", EINTR; $sess_id = POSIX::setsid(); $fd = POSIX::open($path, O_CREAT|O_EXCL|O_WRONLY, 0644); =head1 DESCRIPTION The POSIX module permits you to access all (or nearly all) the standard I<Everything is exported by default> with the exception of any POSIX This document gives a condensed list of the features available in the POSIX The first section describes POSIX functions from the 1003.1 specification. =head1 CAVEATS A few functions are not implemented because they are C specific. If you Furthermore, some evil vendors will claim 1003.1 compliance, but in fact =head1 FUNCTIONS =over 8 =item _exit This is identical to the C function C<_exit()>. It exits the program Note that when using threads and in Linux this is B<not> a good way to =item abort This is identical to the C function C<abort()>. It terminates the =item abs This is identical to Perl's builtin C<abs()> function, returning =item access Determines the accessibility of a file. if( POSIX::access( "/", &POSIX::R_OK ) ){ Returns C<undef> on failure. Note: do not use C<access()> for =item acos This is identical to the C function C<acos()>, returning =item alarm This is identical to Perl's builtin C<alarm()> function, =item asctime This is identical to the C function C<asctime()>. It returns "Fri Jun 2 18:22:13 2000\n\0" and it is called thusly $asctime = asctime($sec, $min, $hour, $mday, $mon, $year, The C<$mon> is zero-based: January equals C<0>. The C<$year> is =item asin This is identical to the C function C<asin()>, returning =item assert Unimplemented, but you can use L<perlfunc/die> and the L<Carp> module =item atan This is identical to the C function C<atan()>, returning the =item atan2 This is identical to Perl's builtin C<atan2()> function, returning =item atexit atexit() is C-specific: use C<END {}> instead, see L<perlsub>. =item atof atof() is C-specific. Perl converts strings to numbers transparently. =item atoi atoi() is C-specific. Perl converts strings to numbers transparently. =item atol atol() is C-specific. Perl converts strings to numbers transparently. =item bsearch bsearch() not supplied. For doing binary search on wordlists, =item calloc calloc() is C-specific. Perl does memory management transparently. =item ceil This is identical to the C function C<ceil()>, returning the smallest =item chdir This is identical to Perl's builtin C<chdir()> function, allowing =item chmod This is identical to Perl's builtin C<chmod()> function, allowing =item chown This is identical to Perl's builtin C<chown()> function, allowing one =item clearerr Use the method C<IO::Handle::clearerr()> instead, to reset the error =item clock This is identical to the C function C<clock()>, returning the =item close Close the file. This uses file descriptors such as those obtained by calling $fd = POSIX::open( "foo", &POSIX::O_RDONLY ); Returns C<undef> on failure. See also L<perlfunc/close>. =item closedir This is identical to Perl's builtin C<closedir()> function for closing =item cos This is identical to Perl's builtin C<cos()> function, for returning =item cosh This is identical to the C function C<cosh()>, for returning =item creat Create a new file. This returns a file descriptor like the ones returned by $fd = POSIX::creat( "foo", 0611 ); See also L<perlfunc/sysopen> and its C<O_CREAT> flag. =item ctermid Generates the path name for the controlling terminal. $path = POSIX::ctermid(); =item ctime This is identical to the C function C<ctime()> and equivalent =item cuserid Get the login name of the owner of the current process. $name = POSIX::cuserid(); =item difftime This is identical to the C function C<difftime()>, for returning =item div div() is C-specific, use L<perlfunc/int> on the usual C</> division and =item dup This is similar to the C function C<dup()>, for duplicating a file This uses file descriptors such as those obtained by calling Returns C<undef> on failure. =item dup2 This is similar to the C function C<dup2()>, for duplicating a file This uses file descriptors such as those obtained by calling Returns C<undef> on failure. =item errno Returns the value of errno. $errno = POSIX::errno(); This identical to the numerical values of the C<$!>, see L<perlvar/$ERRNO>. =item execl execl() is C-specific, see L<perlfunc/exec>. =item execle execle() is C-specific, see L<perlfunc/exec>. =item execlp execlp() is C-specific, see L<perlfunc/exec>. =item execv execv() is C-specific, see L<perlfunc/exec>. =item execve execve() is C-specific, see L<perlfunc/exec>. =item execvp execvp() is C-specific, see L<perlfunc/exec>. =item exit This is identical to Perl's builtin C<exit()> function for exiting the =item exp This is identical to Perl's builtin C<exp()> function for =item fabs This is identical to Perl's builtin C<abs()> function for returning =item fclose Use method C<IO::Handle::close()> instead, or see L<perlfunc/close>. =item fcntl This is identical to Perl's builtin C<fcntl()> function, =item fdopen Use method C<IO::Handle::new_from_fd()> instead, or see L<perlfunc/open>. =item feof Use method C<IO::Handle::eof()> instead, or see L<perlfunc/eof>. =item ferror Use method C<IO::Handle::error()> instead. =item fflush Use method C<IO::Handle::flush()> instead. =item fgetc Use method C<IO::Handle::getc()> instead, or see L<perlfunc/read>. =item fgetpos Use method C<IO::Seekable::getpos()> instead, or see L<perlfunc/seek>. =item fgets Use method C<IO::Handle::gets()> instead. Similar to E<lt>E<gt>, also known =item fileno Use method C<IO::Handle::fileno()> instead, or see L<perlfunc/fileno>. =item floor This is identical to the C function C<floor()>, returning the largest =item fmod This is identical to the C function C<fmod()>. $r = fmod($x, $y); It returns the remainder C<$r = $x - $n*$y>, where C<$n = trunc($x/$y)>. =item fopen Use method C<IO::File::open()> instead, or see L<perlfunc/open>. =item fork This is identical to Perl's builtin C<fork()> function =item fpathconf Retrieves the value of a configurable limit on a file or directory. This The following will determine the maximum length of the longest allowable $fd = POSIX::open( "/var/foo", &POSIX::O_RDONLY ); Returns C<undef> on failure. =item fprintf fprintf() is C-specific, see L<perlfunc/printf> instead. =item fputc fputc() is C-specific, see L<perlfunc/print> instead. =item fputs fputs() is C-specific, see L<perlfunc/print> instead. =item fread fread() is C-specific, see L<perlfunc/read> instead. =item free free() is C-specific. Perl does memory management transparently. =item freopen freopen() is C-specific, see L<perlfunc/open> instead. =item frexp Return the mantissa and exponent of a floating-point number. ($mantissa, $exponent) = POSIX::frexp( 1.234e56 ); =item fscanf fscanf() is C-specific, use E<lt>E<gt> and regular expressions instead. =item fseek Use method C<IO::Seekable::seek()> instead, or see L<perlfunc/seek>. =item fsetpos Use method C<IO::Seekable::setpos()> instead, or seek L<perlfunc/seek>. =item fstat Get file status. This uses file descriptors such as those obtained by $fd = POSIX::open( "foo", &POSIX::O_RDONLY ); =item fsync Use method C<IO::Handle::sync()> instead. =item ftell Use method C<IO::Seekable::tell()> instead, or see L<perlfunc/tell>. =item fwrite fwrite() is C-specific, see L<perlfunc/print> instead. =item getc This is identical to Perl's builtin C<getc()> function, =item getchar Returns one character from STDIN. Identical to Perl's C<getc()>, =item getcwd Returns the name of the current working directory. =item getegid Returns the effective group identifier. Similar to Perl' s builtin =item getenv Returns the value of the specified environment variable. =item geteuid Returns the effective user identifier. Identical to Perl's builtin C<$E<gt>> =item getgid Returns the user's real group identifier. Similar to Perl's builtin =item getgrgid This is identical to Perl's builtin C<getgrgid()> function for =item getgrnam This is identical to Perl's builtin C<getgrnam()> function for =item getgroups Returns the ids of the user's supplementary groups. Similar to Perl's =item getlogin This is identical to Perl's builtin C<getlogin()> function for =item getpgrp This is identical to Perl's builtin C<getpgrp()> function for =item getpid Returns the process identifier. Identical to Perl's builtin =item getppid This is identical to Perl's builtin C<getppid()> function for =item getpwnam This is identical to Perl's builtin C<getpwnam()> function for =item getpwuid This is identical to Perl's builtin C<getpwuid()> function for =item gets Returns one line from C<STDIN>, similar to E<lt>E<gt>, also known B<NOTE>: if you have C programs that still use C<gets()>, be very =item getuid Returns the user's identifier. Identical to Perl's builtin C<$E<lt>> variable, =item gmtime This is identical to Perl's builtin C<gmtime()> function for =item isalnum This is identical to the C function, except that it can apply to a =item isalpha This is identical to the C function, except that it can apply to =item isatty Returns a boolean indicating whether the specified filehandle is connected =item iscntrl This is identical to the C function, except that it can apply to =item isdigit This is identical to the C function, except that it can apply to =item isgraph This is identical to the C function, except that it can apply to =item islower This is identical to the C function, except that it can apply to =item isprint This is identical to the C function, except that it can apply to =item ispunct This is identical to the C function, except that it can apply to =item isspace This is identical to the C function, except that it can apply to =item isupper This is identical to the C function, except that it can apply to =item isxdigit This is identical to the C function, except that it can apply to a single =item kill This is identical to Perl's builtin C<kill()> function for sending =item labs (For returning absolute values of long integers.) =item lchown This is identical to the C function, except the order of arguments is =item ldexp This is identical to the C function C<ldexp()> $x_quadrupled = POSIX::ldexp($x, 2); =item ldiv (For computing dividends of long integers.) =item link This is identical to Perl's builtin C<link()> function =item localeconv Get numeric formatting information. Returns a reference to a hash Here is how to query the database for the B<de> (Deutsch or German) locale. $loc = POSIX::setlocale( &POSIX::LC_ALL, "de" ); =item localtime This is identical to Perl's builtin C<localtime()> function for =item log This is identical to Perl's builtin C<log()> function, =item log10 This is identical to the C function C<log10()>, sub log10 { log($_[0]) / log(10) } or sub log10 { log($_[0]) / 2.30258509299405 } or sub log10 { log($_[0]) * 0.434294481903252 } =item longjmp longjmp() is C-specific: use L<perlfunc/die> instead. =item lseek Move the file's read/write position. This uses file descriptors such as $fd = POSIX::open( "foo", &POSIX::O_RDONLY ); Returns C<undef> on failure. =item malloc malloc() is C-specific. Perl does memory management transparently. =item mblen This is identical to the C function C<mblen()>. =item mbstowcs This is identical to the C function C<mbstowcs()>. =item mbtowc This is identical to the C function C<mbtowc()>. =item memchr memchr() is C-specific, see L<perlfunc/index> instead. =item memcmp memcmp() is C-specific, use C<eq> instead, see L<perlop>. =item memcpy memcpy() is C-specific, use C<=>, see L<perlop>, or see L<perlfunc/substr>. =item memmove memmove() is C-specific, use C<=>, see L<perlop>, or see L<perlfunc/substr>. =item memset memset() is C-specific, use C<x> instead, see L<perlop>. =item mkdir This is identical to Perl's builtin C<mkdir()> function =item mkfifo This is similar to the C function C<mkfifo()> for creating if (mkfifo($path, $mode)) { .... Returns C<undef> on failure. The C<$mode> is similar to the =item mktime Convert date/time info to a calendar time. Synopsis: mktime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = -1) The month (C<mon>), weekday (C<wday>), and yearday (C<yday>) begin at zero. Calendar time for December 12, 1995, at 10:30 am. $time_t = POSIX::mktime( 0, 30, 10, 12, 11, 95 ); Returns C<undef> on failure. =item modf Return the integral and fractional parts of a floating-point number. ($fractional, $integral) = POSIX::modf( 3.14 ); =item nice This is similar to the C function C<nice()>, for changing Returns C<undef> on failure. =item offsetof offsetof() is C-specific, you probably want to see L<perlfunc/pack> instead. =item open Open a file for reading for writing. This returns file descriptors, not Open a file read-only with mode 0666. $fd = POSIX::open( "foo" ); Open a file for read and write. $fd = POSIX::open( "foo", &POSIX::O_RDWR ); Open a file for write, with truncation. $fd = POSIX::open( "foo", &POSIX::O_WRONLY | &POSIX::O_TRUNC ); Create a new file with mode 0640. Set up the file for writing. $fd = POSIX::open( "foo", &POSIX::O_CREAT | &POSIX::O_WRONLY, 0640 ); Returns C<undef> on failure. See also L<perlfunc/sysopen>. =item opendir Open a directory for reading. $dir = POSIX::opendir( "/var" ); Returns C<undef> on failure. =item pathconf Retrieves the value of a configurable limit on a file or directory. The following will determine the maximum length of the longest allowable $path_max = POSIX::pathconf( "/var", &POSIX::_PC_PATH_MAX ); Returns C<undef> on failure. =item pause This is similar to the C function C<pause()>, which suspends Returns C<undef> on failure. =item perror This is identical to the C function C<perror()>, which outputs to the =item pipe Create an interprocess channel. This returns file descriptors like those my ($read, $write) = POSIX::pipe(); See also L<perlfunc/pipe>. =item pow Computes C<$x> raised to the power C<$exponent>. $ret = POSIX::pow( $x, $exponent ); You can also use the C<**> operator, see L<perlop>. =item printf Formats and prints the specified arguments to STDOUT. =item putc putc() is C-specific, see L<perlfunc/print> instead. =item putchar putchar() is C-specific, see L<perlfunc/print> instead. =item puts puts() is C-specific, see L<perlfunc/print> instead. =item qsort qsort() is C-specific, see L<perlfunc/sort> instead. =item raise Sends the specified signal to the current process. =item rand C<rand()> is non-portable, see L<perlfunc/rand> instead. =item read Read from a file. This uses file descriptors such as those obtained by $fd = POSIX::open( "foo", &POSIX::O_RDONLY ); Returns C<undef> on failure. See also L<perlfunc/sysread>. =item readdir This is identical to Perl's builtin C<readdir()> function =item realloc realloc() is C-specific. Perl does memory management transparently. =item remove This is identical to Perl's builtin C<unlink()> function =item rename This is identical to Perl's builtin C<rename()> function =item rewind Seeks to the beginning of the file. =item rewinddir This is identical to Perl's builtin C<rewinddir()> function for =item rmdir This is identical to Perl's builtin C<rmdir()> function =item scanf scanf() is C-specific, use E<lt>E<gt> and regular expressions instead, =item setgid Sets the real group identifier and the effective group identifier for =item setjmp C<setjmp()> is C-specific: use C<eval {}> instead, =item setlocale Modifies and queries program's locale. The following examples assume use POSIX qw(setlocale LC_ALL LC_CTYPE); has been issued. The following will set the traditional UNIX system locale behavior $loc = setlocale( LC_ALL, "C" ); The following will query the current LC_CTYPE category. (No second $loc = setlocale( LC_CTYPE ); The following will set the LC_CTYPE behaviour according to the locale $loc = setlocale( LC_CTYPE, "" ); The following will set the LC_COLLATE behaviour to Argentinian $loc = setlocale( LC_COLLATE, "es_AR.ISO8859-1" ); =item setpgid This is similar to the C function C<setpgid()> for Returns C<undef> on failure. =item setsid This is identical to the C function C<setsid()> for =item setuid Sets the real user identifier and the effective user identifier for =item sigaction Detailed signal management. This uses C<POSIX::SigAction> objects for Synopsis: sigaction(signal, action, oldaction = 0) Returns C<undef> on failure. The C<signal> must be a number (like If you use the SA_SIGINFO flag, the signal handler will in addition to signo the signal number The following are also defined by POSIX/SUSv3, but unfortunately pid the process id generating the signal A third argument is also passed to the handler, which contains a copy Note that not all siginfo values make sense simultaneously (some are =item siglongjmp siglongjmp() is C-specific: use L<perlfunc/die> instead. =item sigpending Examine signals that are blocked and pending. This uses C<POSIX::SigSet> Synopsis: sigpending(sigset) Returns C<undef> on failure. =item sigprocmask Change and/or examine calling process's signal mask. This uses Synopsis: sigprocmask(how, sigset, oldsigset = 0) Returns C<undef> on failure. Note that you can't reliably block or unblock a signal from its own signal =item sigsetjmp C<sigsetjmp()> is C-specific: use C<eval {}> instead, =item sigsuspend Install a signal mask and suspend process until signal arrives. This uses Synopsis: sigsuspend(signal_mask) Returns C<undef> on failure. =item sin This is identical to Perl's builtin C<sin()> function =item sinh This is identical to the C function C<sinh()> =item sleep This is functionally identical to Perl's builtin C<sleep()> function =item sprintf This is similar to Perl's builtin C<sprintf()> function =item sqrt This is identical to Perl's builtin C<sqrt()> function. =item srand Give a seed the pseudorandom number generator, see L<perlfunc/srand>. =item sscanf sscanf() is C-specific, use regular expressions instead, =item stat This is identical to Perl's builtin C<stat()> function =item strcat strcat() is C-specific, use C<.=> instead, see L<perlop>. =item strchr strchr() is C-specific, see L<perlfunc/index> instead. =item strcmp strcmp() is C-specific, use C<eq> or C<cmp> instead, see L<perlop>. =item strcoll This is identical to the C function C<strcoll()> =item strcpy strcpy() is C-specific, use C<=> instead, see L<perlop>. =item strcspn strcspn() is C-specific, use regular expressions instead, =item strerror Returns the error string for the specified errno. =item strftime Convert date and time information to string. Returns the string. Synopsis: strftime(fmt, sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = -1) The month (C<mon>), weekday (C<wday>), and yearday (C<yday>) begin at zero. If you want your code to be portable, your format (C<fmt>) argument The given arguments are made consistent as though by calling The string for Tuesday, December 12, 1995. $str = POSIX::strftime( "%A, %B %d, %Y", 0, 0, 0, 12, 11, 95, 2 ); =item strlen strlen() is C-specific, use C<length()> instead, see L<perlfunc/length>. =item strncat strncat() is C-specific, use C<.=> instead, see L<perlop>. =item strncmp strncmp() is C-specific, use C<eq> instead, see L<perlop>. =item strncpy strncpy() is C-specific, use C<=> instead, see L<perlop>. =item strpbrk strpbrk() is C-specific, use regular expressions instead, =item strrchr strrchr() is C-specific, see L<perlfunc/rindex> instead. =item strspn strspn() is C-specific, use regular expressions instead, =item strstr This is identical to Perl's builtin C<index()> function, =item strtod String to double translation. Returns the parsed number and the number strtod should respect any POSIX I<setlocale()> settings. To parse a string $str as a floating point number use $! = 0; The second returned item and $! can be used to check for valid input: if (( When called in a scalar context strtod returns the parsed number. =item strtok strtok() is C-specific, use regular expressions instead, see =item strtol String to (long) integer translation. Returns the parsed number and strtol should respect any POSIX I<setlocale()> settings. To parse a string $str as a number in some base $base use $! = 0; The base should be zero or between 2 and 36, inclusive. When the base The second returned item and $! can be used to check for valid input: if (( When called in a scalar context strtol returns the parsed number. =item strtoul String to unsigned (long) integer translation. strtoul() is identical Note: Some vendors supply strtod() and strtol() but not strtoul(). =item strxfrm String transformation. Returns the transformed string. $dst = POSIX::strxfrm( $src ); Used in conjunction with the C<strcoll()> function, see L</strcoll>. Not really needed since Perl can do this transparently, see =item sysconf Retrieves values of system configurable variables. The following will get the machine's clock speed. $clock_ticks = POSIX::sysconf( &POSIX::_SC_CLK_TCK ); Returns C<undef> on failure. =item system This is identical to Perl's builtin C<system()> function, see =item tan This is identical to the C function C<tan()>, returning the =item tanh This is identical to the C function C<tanh()>, returning the =item tcdrain This is similar to the C function C<tcdrain()> for draining Returns C<undef> on failure. =item tcflow This is similar to the C function C<tcflow()> for controlling Returns C<undef> on failure. =item tcflush This is similar to the C function C<tcflush()> for flushing Returns C<undef> on failure. =item tcgetpgrp This is identical to the C function C<tcgetpgrp()> for returning the =item tcsendbreak This is similar to the C function C<tcsendbreak()> for sending Returns C<undef> on failure. =item tcsetpgrp This is similar to the C function C<tcsetpgrp()> for setting the Returns C<undef> on failure. =item time This is identical to Perl's builtin C<time()> function =item times The times() function returns elapsed realtime since some point in the past ($realtime, $user, $system, $cuser, $csystem) = POSIX::times(); Note: Perl's builtin C<times()> function returns four values, measured in =item tmpfile Use method C<IO::File::new_tmpfile()> instead, or see L<File::Temp>. =item tmpnam Returns a name for a temporary file. $tmpfile = POSIX::tmpnam(); For security reasons, which are probably detailed in your system's =item tolower This is identical to the C function, except that it can apply to a single =item toupper This is identical to the C function, except that it can apply to a single =item ttyname This is identical to the C function C<ttyname()> for returning the =item tzname Retrieves the time conversion information from the C<tzname> variable. POSIX::tzset(); =item tzset This is identical to the C function C<tzset()> for setting =item umask This is identical to Perl's builtin C<umask()> function =item uname Get name of current operating system. ($sysname, $nodename, $release, $version, $machine) = POSIX::uname(); Note that the actual meanings of the various fields are not =item ungetc Use method C<IO::Handle::ungetc()> instead. =item unlink This is identical to Perl's builtin C<unlink()> function =item utime This is identical to Perl's builtin C<utime()> function =item vfprintf vfprintf() is C-specific, see L<perlfunc/printf> instead. =item vprintf vprintf() is C-specific, see L<perlfunc/printf> instead. =item vsprintf vsprintf() is C-specific, see L<perlfunc/sprintf> instead. =item wait This is identical to Perl's builtin C<wait()> function, =item waitpid Wait for a child process to change state. This is identical to Perl's $pid = POSIX::waitpid( -1, POSIX::WNOHANG ); =item wcstombs This is identical to the C function C<wcstombs()>. =item wctomb This is identical to the C function C<wctomb()>. =item write Write to a file. This uses file descriptors such as those obtained by $fd = POSIX::open( "foo", &POSIX::O_WRONLY ); Returns C<undef> on failure. See also L<perlfunc/syswrite>. =back =head1 CLASSES =head2 POSIX::SigAction =over 8 =item new Creates a new C<POSIX::SigAction> object which corresponds to the C $sigset = POSIX::SigSet->new(SIGINT, SIGQUIT); This C<POSIX::SigAction> object is intended for use with the C<POSIX::sigaction()> =back =over 8 =item handler =item mask =item flags accessor functions to get/set the values of a SigAction object. $sigset = $sigaction->mask; =item safe accessor function for the "safe signals" flag of a SigAction object; see $sigaction->safe(1); You may also examine the "safe" flag on the output action object which is sigaction(SIGINT, $new_action, $old_action); =back =head2 POSIX::SigRt =over 8 =item %SIGRT A hash of the POSIX realtime signal handlers. It is an extension of You can set the %POSIX::SIGRT elements to set the POSIX realtime Setting the %SIGRT elements is equivalent to calling this: sub new { The flags default to zero, if you want something different you can Just as with any signal, you can use sigaction($rtsig, undef, $oa) to B<NOTE:> whether POSIX realtime signals really work in your system, or =item SIGRTMIN Return the minimum POSIX realtime signal number available, or C<undef> =item SIGRTMAX Return the maximum POSIX realtime signal number available, or C<undef> =back =head2 POSIX::SigSet =over 8 =item new Create a new SigSet object. This object will be destroyed automatically Create an empty set. $sigset = POSIX::SigSet->new; Create a set with SIGUSR1. $sigset = POSIX::SigSet->new( &POSIX::SIGUSR1 ); =item addset Add a signal to a SigSet object. $sigset->addset( &POSIX::SIGUSR2 ); Returns C<undef> on failure. =item delset Remove a signal from the SigSet object. $sigset->delset( &POSIX::SIGUSR2 ); Returns C<undef> on failure. =item emptyset Initialize the SigSet object to be empty. $sigset->emptyset(); Returns C<undef> on failure. =item fillset Initialize the SigSet object to include all signals. $sigset->fillset(); Returns C<undef> on failure. =item ismember Tests the SigSet object to see if it contains a specific signal. if( $sigset->ismember( &POSIX::SIGUSR1 ) ){ =back =head2 POSIX::Termios =over 8 =item new Create a new Termios object. This object will be destroyed automatically $termios = POSIX::Termios->new; =item getattr Get terminal control attributes. Obtain the attributes for stdin. $termios->getattr( 0 ) # Recommended for clarity. Obtain the attributes for stdout. $termios->getattr( 1 ) Returns C<undef> on failure. =item getcc Retrieve a value from the c_cc field of a termios object. The c_cc field is $c_cc[1] = $termios->getcc(1); =item getcflag Retrieve the c_cflag field of a termios object. $c_cflag = $termios->getcflag; =item getiflag Retrieve the c_iflag field of a termios object. $c_iflag = $termios->getiflag; =item getispeed Retrieve the input baud rate. $ispeed = $termios->getispeed; =item getlflag Retrieve the c_lflag field of a termios object. $c_lflag = $termios->getlflag; =item getoflag Retrieve the c_oflag field of a termios object. $c_oflag = $termios->getoflag; =item getospeed Retrieve the output baud rate. $ospeed = $termios->getospeed; =item setattr Set terminal control attributes. Set attributes immediately for stdout. $termios->setattr( 1, &POSIX::TCSANOW ); Returns C<undef> on failure. =item setcc Set a value in the c_cc field of a termios object. The c_cc field is an $termios->setcc( &POSIX::VEOF, 1 ); =item setcflag Set the c_cflag field of a termios object. $termios->setcflag( $c_cflag | &POSIX::CLOCAL ); =item setiflag Set the c_iflag field of a termios object. $termios->setiflag( $c_iflag | &POSIX::BRKINT ); =item setispeed Set the input baud rate. $termios->setispeed( &POSIX::B9600 ); Returns C<undef> on failure. =item setlflag Set the c_lflag field of a termios object. $termios->setlflag( $c_lflag | &POSIX::ECHO ); =item setoflag Set the c_oflag field of a termios object. $termios->setoflag( $c_oflag | &POSIX::OPOST ); =item setospeed Set the output baud rate. $termios->setospeed( &POSIX::B9600 ); Returns C<undef> on failure. =item Baud rate values B38400 B75 B200 B134 B300 B1800 B150 B0 B19200 B1200 B9600 B600 B4800 B50 B2400 B110 =item Terminal interface values TCSADRAIN TCSANOW TCOON TCIOFLUSH TCOFLUSH TCION TCIFLUSH TCSAFLUSH TCIOFF TCOOFF =item c_cc field values VEOF VEOL VERASE VINTR VKILL VQUIT VSUSP VSTART VSTOP VMIN VTIME NCCS =item c_cflag field values CLOCAL CREAD CSIZE CS5 CS6 CS7 CS8 CSTOPB HUPCL PARENB PARODD =item c_iflag field values BRKINT ICRNL IGNBRK IGNCR IGNPAR INLCR INPCK ISTRIP IXOFF IXON PARMRK =item c_lflag field values ECHO ECHOE ECHOK ECHONL ICANON IEXTEN ISIG NOFLSH TOSTOP =item c_oflag field values OPOST =back =head1 PATHNAME CONSTANTS =over 8 =item Constants _PC_CHOWN_RESTRICTED _PC_LINK_MAX _PC_MAX_CANON _PC_MAX_INPUT _PC_NAME_MAX _PC_NO_TRUNC _PC_PATH_MAX _PC_PIPE_BUF _PC_VDISABLE =back =head1 POSIX CONSTANTS =over 8 =item Constants _POSIX_ARG_MAX _POSIX_CHILD_MAX _POSIX_CHOWN_RESTRICTED _POSIX_JOB_CONTROL _POSIX_LINK_MAX _POSIX_MAX_CANON _POSIX_MAX_INPUT _POSIX_NAME_MAX _POSIX_NGROUPS_MAX _POSIX_NO_TRUNC _POSIX_OPEN_MAX _POSIX_PATH_MAX _POSIX_PIPE_BUF _POSIX_SAVED_IDS _POSIX_SSIZE_MAX _POSIX_STREAM_MAX _POSIX_TZNAME_MAX _POSIX_VDISABLE _POSIX_VERSION =back =head1 SYSTEM CONFIGURATION =over 8 =item Constants _SC_ARG_MAX _SC_CHILD_MAX _SC_CLK_TCK _SC_JOB_CONTROL _SC_NGROUPS_MAX _SC_OPEN_MAX _SC_PAGESIZE _SC_SAVED_IDS _SC_STREAM_MAX _SC_TZNAME_MAX _SC_VERSION =back =head1 ERRNO =over 8 =item Constants E2BIG EACCES EADDRINUSE EADDRNOTAVAIL EAFNOSUPPORT EAGAIN EALREADY EBADF =back =head1 FCNTL =over 8 =item Constants FD_CLOEXEC F_DUPFD F_GETFD F_GETFL F_GETLK F_OK F_RDLCK F_SETFD F_SETFL F_SETLK F_SETLKW F_UNLCK F_WRLCK O_ACCMODE O_APPEND O_CREAT O_EXCL O_NOCTTY O_NONBLOCK O_RDONLY O_RDWR O_TRUNC O_WRONLY =back =head1 FLOAT =over 8 =item Constants DBL_DIG DBL_EPSILON DBL_MANT_DIG DBL_MAX DBL_MAX_10_EXP DBL_MAX_EXP DBL_MIN DBL_MIN_10_EXP DBL_MIN_EXP FLT_DIG FLT_EPSILON FLT_MANT_DIG FLT_MAX FLT_MAX_10_EXP FLT_MAX_EXP FLT_MIN FLT_MIN_10_EXP FLT_MIN_EXP FLT_RADIX FLT_ROUNDS LDBL_DIG LDBL_EPSILON LDBL_MANT_DIG LDBL_MAX LDBL_MAX_10_EXP LDBL_MAX_EXP LDBL_MIN LDBL_MIN_10_EXP LDBL_MIN_EXP =back =head1 LIMITS =over 8 =item Constants ARG_MAX CHAR_BIT CHAR_MAX CHAR_MIN CHILD_MAX INT_MAX INT_MIN LINK_MAX LONG_MAX LONG_MIN MAX_CANON MAX_INPUT MB_LEN_MAX NAME_MAX NGROUPS_MAX OPEN_MAX PATH_MAX PIPE_BUF SCHAR_MAX SCHAR_MIN SHRT_MAX SHRT_MIN SSIZE_MAX STREAM_MAX TZNAME_MAX UCHAR_MAX UINT_MAX ULONG_MAX USHRT_MAX =back =head1 LOCALE =over 8 =item Constants LC_ALL LC_COLLATE LC_CTYPE LC_MONETARY LC_NUMERIC LC_TIME =back =head1 MATH =over 8 =item Constants HUGE_VAL =back =head1 SIGNAL =over 8 =item Constants SA_NOCLDSTOP SA_NOCLDWAIT SA_NODEFER SA_ONSTACK SA_RESETHAND SA_RESTART =back =head1 STAT =over 8 =item Constants S_IRGRP S_IROTH S_IRUSR S_IRWXG S_IRWXO S_IRWXU S_ISGID S_ISUID S_IWGRP S_IWOTH S_IWUSR S_IXGRP S_IXOTH S_IXUSR =item Macros S_ISBLK S_ISCHR S_ISDIR S_ISFIFO S_ISREG =back =head1 STDLIB =over 8 =item Constants EXIT_FAILURE EXIT_SUCCESS MB_CUR_MAX RAND_MAX =back =head1 STDIO =over 8 =item Constants BUFSIZ EOF FILENAME_MAX L_ctermid L_cuserid L_tmpname TMP_MAX =back =head1 TIME =over 8 =item Constants CLK_TCK CLOCKS_PER_SEC =back =head1 UNISTD =over 8 =item Constants R_OK SEEK_CUR SEEK_END SEEK_SET STDIN_FILENO STDOUT_FILENO STDERR_FILENO W_OK X_OK =back =head1 WAIT =over 8 =item Constants WNOHANG WUNTRACED =over 16 =item WNOHANG Do not suspend the calling process until a child process =item WUNTRACED Catch stopped child processes. =back =item Macros WIFEXITED WEXITSTATUS WIFSIGNALED WTERMSIG WIFSTOPPED WSTOPSIG =over 16 =item WIFEXITED WIFEXITED(${^CHILD_ERROR_NATIVE}) returns true if the child process =item WEXITSTATUS WEXITSTATUS(${^CHILD_ERROR_NATIVE}) returns the normal exit status of =item WIFSIGNALED WIFSIGNALED(${^CHILD_ERROR_NATIVE}) returns true if the child process =item WTERMSIG WTERMSIG(${^CHILD_ERROR_NATIVE}) returns the signal the child process =item WIFSTOPPED WIFSTOPPED(${^CHILD_ERROR_NATIVE}) returns true if the child process is =item WSTOPSIG WSTOPSIG(${^CHILD_ERROR_NATIVE}) returns the signal the child process =back =back |
From @xsawyerxOn 09/26/2017 03:03 PM, James E Keenan via RT wrote:
That sounds like a good plan to me. With regards to step 2, it might be easier to add the test again The testing part can at least be automated but perhaps some of the rest I wish we could track this better. Perhaps with a GH issue? Thanks, Jim! |
From @jkeenanOn Wed, 27 Sep 2017 12:51:55 GMT, xsawyerx@gmail.com wrote:
The way I read the existing tests, it seems that this automation has already been accomplished by Nicholas Clark back in 2011 in ext/POSIX/t/usage.t. What do you think is needed above and beyond that?
-- |
From @xsawyerxOn 09/27/2017 04:07 PM, James E Keenan via RT wrote:
Nothing, I guess. I thought you wanted to add more tests and |
From @jkeenanOn Sun, 24 Sep 2017 18:17:07 GMT, jkeenan wrote:
Partially done in commit bda53d3. -- |
Migrated from rt.perl.org#132145 (status was 'open')
Searchable as RT132145$
The text was updated successfully, but these errors were encountered: