From ea9eb35a366bc919762b9c4072c62d67709cbb9d Mon Sep 17 00:00:00 2001 From: bojilund Date: Tue, 7 Jun 2011 09:32:31 +0200 Subject: [PATCH] Improve documentation to support portability If something has a portability issue, we should mention it in the main place people will read about the thing with the issue. For Perl built-ins, that's perlfunc. We don't have to explain the issue, but we should at the very least tell people where to find an explanation of the issue. --- pod/perlfunc.pod | 134 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 131 insertions(+), 3 deletions(-) diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index e619424..53c8891 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -430,6 +430,8 @@ C<-x $file && -w _ && -f _>. (This is only fancy fancy: if you use the return value of C<-f $file> as an argument to another filetest operator, no special magic will happen.) +Portability issues: L. + =item abs VALUE X X @@ -500,6 +502,8 @@ modulo the caveats given in L. For more information see L. +Portability issues: L. + =item atan2 Y,X X X X X @@ -513,6 +517,8 @@ function, or use the familiar relation: The return value for C is implementation-defined; consult your atan2(3) manpage for more information. +Portability issues: L. + =item bind SOCKET,NAME X @@ -612,6 +618,8 @@ but also when using read(), seek(), sysread(), syswrite() and tell() in L for how to manually set your input and output line-termination sequences. +Portability issues: L. + =item bless REF,CLASSNAME X @@ -761,6 +769,8 @@ module: chmod S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH, @executables; # Identical to the chmod 0755 of the example above. +Portability issues: L. + =item chomp VARIABLE X X X<$/> X X @@ -864,6 +874,8 @@ On POSIX systems, you can detect this condition this way: use POSIX qw(sysconf _PC_CHOWN_RESTRICTED); $can_chown_giveaway = not sysconf(_PC_CHOWN_RESTRICTED); +Portability issues: L. + =item chr NUMBER X X X X @@ -898,6 +910,8 @@ change your current working directory, which is unaffected.) For security reasons, this call is restricted to the superuser. If FILENAME is omitted, does a C to C<$_>. +Portability issues: L. + =item close FILEHANDLE X @@ -1089,6 +1103,8 @@ the string back to an eight-bit byte string before calling crypt() (on that copy). If that works, good. If not, crypt() dies with C. +Portability issues: L. + =item dbmclose HASH X @@ -1096,6 +1112,8 @@ X Breaks the binding between a DBM file and a hash. +Portability issues: L. + =item dbmopen HASH,DBNAME,MASK X X X X X @@ -1139,6 +1157,8 @@ before you call dbmopen(): dbmopen(%NS_Hist, "$ENV{HOME}/.netscape/history.db") or die "Can't open netscape history file: $!"; +Portability issues: L. + =item default BLOCK Within a C or a C, a C BLOCK acts like a C @@ -1475,6 +1495,8 @@ convert a core file into an executable. That's why you should now invoke it as C, if you don't want to be warned against a possible typo. +Portability issues: L. + =item each HASH X X @@ -1805,6 +1827,8 @@ open handles to avoid lost output. Note that C will not call your C blocks, nor will it invoke C methods on your objects. +Portability issues: L. + =item exists EXPR X X @@ -1899,6 +1923,8 @@ can change the exit status by modifying C<$?>. If this is a problem, you can call C to avoid END and destructor processing. See L for details. +Portability issues: L. + =item exp EXPR X X X X X @@ -1944,6 +1970,8 @@ on your own, though. $flags = fcntl(REMOTE, F_SETFL, $flags | O_NONBLOCK) or die "Can't set flags for the socket: $!\n"; +Portability issues: L. + =item fileno FILEHANDLE X @@ -2044,6 +2072,8 @@ function lose their locks, making it seriously harder to write servers. See also L for other flock() examples. +Portability issues: L. + =item fork X X X @@ -2073,6 +2103,14 @@ if you exit, then the remote server (such as, say, a CGI script or a backgrounded job launched from a remote shell) won't think you're done. You should reopen those to F if it's any issue. +On some platforms such as Windows, where the fork() system call is not available, +Perl can be built to emulate fork() in the Perl interpreter. The emulation is designed to, +at the level of the Perl program, be as compatible as possible with the "Unix" fork(). +However it has limitation that has to be considered in code intended to be portable. +See L for more details. + +Portability issues: L. + =item format X @@ -2164,6 +2202,8 @@ returns the empty string, use C. Do not consider C for authentication: it is not as secure as C. +Portability issues: L. + =item getpeername SOCKET X X @@ -2186,6 +2226,8 @@ doesn't implement getpgrp(2). If PID is omitted, returns the process group of the current process. Note that the POSIX version of C does not accept a PID argument, so only C is truly portable. +Portability issues: L. + =item getppid X X X @@ -2198,6 +2240,8 @@ C, that returns a consistent value across threads. If you want to call the underlying C, you may use the CPAN module C. +Portability issues: L. + =item getpriority WHICH,WHO X X X @@ -2205,6 +2249,8 @@ Returns the current priority for a process, a process group, or a user. (See C.) Will raise a fatal exception if used on a machine that doesn't implement getpriority(2). +Portability issues: L. + =item getpwnam NAME X X X X X X X X X X @@ -2376,6 +2422,8 @@ Even though it looks as though they're the same method calls (uid), they aren't, because a C object is different from a C object. +Portability issues: L to L. + =item getsockname SOCKET X @@ -2421,6 +2469,7 @@ Here's an example to test whether Nagle's algorithm is enabled on a socket: my $nodelay = unpack("I", $packed); print "Nagle's algorithm is turned ", $nodelay ? "off\n" : "on\n"; +Portability issues: L. =item given EXPR BLOCK X @@ -2475,6 +2524,8 @@ Beginning with v5.6.0, this operator is implemented using the standard C extension. See L for details, including C which does not treat whitespace as a pattern separator. +Portability issues: L. + =item gmtime EXPR X X X @@ -2487,7 +2538,7 @@ Note: When called in list context, $isdst, the last value returned by gmtime, is always C<0>. There is no Daylight Saving Time in GMT. -See L for portability concerns. +Portability issues: L. =item goto LABEL X X X @@ -2664,6 +2715,8 @@ system: The special string C<"0 but true"> is exempt from B<-w> complaints about improper numeric conversions. +Portability issues: L. + =item join EXPR,LIST X @@ -2774,6 +2827,15 @@ signal the current process group and -1 will signal all processes. See L for more details. +On some platforms such as Windows where the fork() system call is not available. +Perl can be built to emulate fork() at the interpreter level. +This emulation has limitation related to kill that has to be considered, +for code running on Windows and in code intended to be portable. + +See L for more details. + +Portability issues: L. + =item last LABEL X X @@ -2900,6 +2962,8 @@ X Creates a new filename linked to the old filename. Returns true for success, false otherwise. +Portability issues: L. + =item listen SOCKET,QUEUESIZE X @@ -2993,8 +3057,6 @@ try for example: Note that the C<%a> and C<%b>, the short forms of the day of the week and the month of the year, may not necessarily be three characters wide. -See L for portability concerns. - The L and L modules provide a convenient, by-name access mechanism to the gmtime() and localtime() functions, respectively. @@ -3002,6 +3064,8 @@ respectively. For a comprehensive date and time representation look at the L module on CPAN. +Portability issues: L. + =item lock THING X @@ -3044,6 +3108,8 @@ information, please see the documentation for C. If EXPR is omitted, stats C<$_>. +Portability issues: L. + =item m// The match operator. See L. @@ -3168,6 +3234,8 @@ C<"0 but true"> for zero, or the actual return value otherwise. See also L and the documentation for C and C. +Portability issues: L. + =item msgget KEY,FLAGS X @@ -3176,6 +3244,8 @@ id, or C on error. See also L and the documentation for C and C. +Portability issues: L. + =item msgrcv ID,VAR,SIZE,TYPE,FLAGS X @@ -3188,6 +3258,8 @@ Taints the variable. Returns true if successful, false on error. See also L and the documentation for C and C. +Portability issues: L. + =item msgsnd ID,MSG,FLAGS X @@ -3199,6 +3271,8 @@ C. Returns true if successful, false on error. See also the C and C documentation. +Portability issues: L. + =item my EXPR X @@ -3708,6 +3782,8 @@ yourself and inspect the return value. See L for some details about mixing reading and writing. +Portability issues: L. + =item opendir DIRHANDLE,EXPR X @@ -4826,6 +4902,8 @@ implemented. If not, raises an exception. If there is a system error, returns the undefined value and sets C<$!> (errno). If EXPR is omitted, uses C<$_>. +Portability issues: L. + =item readpipe EXPR =item readpipe @@ -4959,6 +5037,8 @@ rename(2) manpage or equivalent system documentation for details. For a platform independent C function look at the L module. +Portability issues: L. + =item require VERSION X @@ -5219,6 +5299,8 @@ X Sets the current position to the beginning of the directory for the C routine on DIRHANDLE. +Portability issues: L. + =item rindex STR,SUBSTR,POSITION X @@ -5377,6 +5459,8 @@ methods, preferring to write the last example as: use IO::Handle; STDERR->autoflush(1); +Portability issues: L. + =item select RBITS,WBITS,EBITS,TIMEOUT X, except as permitted by POSIX, and even then only on POSIX systems. You have to use C instead. +Portability issues: L. + =item semctl ID,SEMNUM,CMD,ARG X @@ -5457,6 +5543,8 @@ short integers, which may be created with C. See also L, C, C documentation. +Portability issues: L. + =item semget KEY,NSEMS,FLAGS X @@ -5465,6 +5553,8 @@ the undefined value on error. See also L, C, C documentation. +Portability issues: L. + =item semop KEY,OPSTRING X @@ -5483,6 +5573,8 @@ To signal the semaphore, replace C<-1> with C<1>. See also L, C, and C documentation. +Portability issues: L. + =item send SOCKET,MSG,FLAGS,TO X @@ -5513,6 +5605,8 @@ it defaults to C<0,0>. Note that the BSD 4.2 version of C does not accept any arguments, so only C is portable. See also C. +Portability issues: L. + =item setpriority WHICH,WHO,PRIORITY X X X X @@ -5520,6 +5614,8 @@ Sets the current priority for a process, a process group, or a user. (See setpriority(2).) Raises an exception when used on a machine that doesn't implement setpriority(2). +Portability issues: L. + =item setsockopt SOCKET,LEVEL,OPTNAME,OPTVAL X @@ -5534,6 +5630,8 @@ An example disabling Nagle's algorithm on a socket: use Socket qw(IPPROTO_TCP TCP_NODELAY); setsockopt($socket, IPPROTO_TCP, TCP_NODELAY, 1); +Portability issues: L. + =item shift ARRAY X @@ -5571,6 +5669,8 @@ structure. Returns like ioctl: C for error; "C<0> but true" for zero; and the actual return value otherwise. See also L and C documentation. +Portability issues: L. + =item shmget KEY,SIZE,FLAGS X @@ -5578,6 +5678,8 @@ Calls the System V IPC function shmget. Returns the shared memory segment id, or C on error. See also L and C documentation. +Portability issues: L. + =item shmread ID,VAR,POS,SIZE X X @@ -5593,6 +5695,8 @@ SIZE bytes. Return true if successful, false on error. shmread() taints the variable. See also L, C, and the C module from CPAN. +Portability issues: L and L. + =item shutdown SOCKET,HOW X @@ -5697,6 +5801,8 @@ See L for an example of socketpair use. Perl 5.8 and later will emulate socketpair using IP sockets to localhost if your system implements sockets but not socketpair. +Portability issues: L. + =item sort SUBNAME LIST X X X X @@ -6605,6 +6711,8 @@ See your native chmod(2) and stat(2) documentation for more details about the C constants. To get status info for a symbolic link instead of the target file behind the link, use the C function. +Portability issues: L. + =item state EXPR X @@ -6774,6 +6882,8 @@ use eval: $symlink_exists = eval { symlink("",""); 1 }; +Portability issues: L. + =item syscall NUMBER, LIST X X @@ -6809,6 +6919,8 @@ number of the read end of the pipe it creates, but there is no way to retrieve the file number of the other end. You can avoid this problem by using C instead. +Portability issues: L. + =item sysopen FILEHANDLE,FILENAME,MODE X @@ -6872,6 +6984,8 @@ library, or perhaps using the POSIX::open() function. See L for a kinder, gentler explanation of opening files. +Portability issues: L. + =item sysread FILEHANDLE,SCALAR,LENGTH,OFFSET X @@ -7007,6 +7121,8 @@ See L and L for details. Since C does a C and C it may affect a C handler. See L for details. +Portability issues: L. + =item syswrite FILEHANDLE,SCALAR,LENGTH,OFFSET X @@ -7201,6 +7317,8 @@ In scalar context, C returns C<$user>. Children's times are only included for terminated children. +Portability issues: L. + =item tr/// The transliteration operator. Same as C. See @@ -7221,6 +7339,8 @@ file. The position in the file of FILEHANDLE is left unchanged. You may want to call L before writing to the file. +Portability issues: L. + =item uc EXPR X X X @@ -7288,6 +7408,8 @@ not trying to restrict access for yourself, returns C. Remember that a umask is a number, usually given in octal; it is I a string of octal digits. See also L, if all you have is a string. +Portability issues: L. + =item undef EXPR X X @@ -7598,6 +7720,8 @@ files. On systems that don't support futimes(2), passing filehandles raises an exception. Filehandles must be passed as globs or glob references to be recognized; barewords are considered filenames. +Portability issues: L. + =item values HASH X @@ -7891,6 +8015,8 @@ being automatically reaped, as described in L. If you use wait in your handler for $SIG{CHLD} it may accidentally for the child created by qx() or system(). See L for details. +Portability issues: L. + =item waitpid PID,FLAGS X @@ -7916,6 +8042,8 @@ Note that on some systems, a return value of C<-1> could mean that child processes are being automatically reaped. See L for details, and for other examples. +Portability issues: L. + =item wantarray X X -- 2.7.4