fix outdated URLs (from Michael G Schwern)
[p5sagit/p5-mst-13.2.git] / pod / perlport.pod
index 6837b4c..3009780 100644 (file)
@@ -90,7 +90,7 @@ Perl uses C<\n> to represent the "logical" newline, where what is
 logical may depend on the platform in use.  In MacPerl, C<\n> always
 means C<\015>.  In DOSish perls, C<\n> usually means C<\012>, but
 when accessing a file in "text" mode, STDIO translates it to (or
-from) C<\015\012>, depending on whether your reading or writing.
+from) C<\015\012>, depending on whether you're reading or writing.
 Unix does the same thing on ttys in canonical mode.  C<\015\012>
 is commonly referred to as CRLF.
 
@@ -180,12 +180,25 @@ usually either "live" via network connection, or by storing the
 numbers to secondary storage such as a disk file or tape.
 
 Conflicting storage orders make utter mess out of the numbers.  If a
-little-endian host (Intel, Alpha) stores 0x12345678 (305419896 in
+little-endian host (Intel, VAX) stores 0x12345678 (305419896 in
 decimal), a big-endian host (Motorola, MIPS, Sparc, PA) reads it as
 0x78563412 (2018915346 in decimal).  To avoid this problem in network
 (socket) connections use the C<pack> and C<unpack> formats C<n>
 and C<N>, the "network" orders.  These are guaranteed to be portable.
 
+You can explore the endianness of your platform by unpacking a
+data structure packed in native format such as:
+
+    print unpack("h*", pack("s2", 1, 2)), "\n";
+    # '10002000' on e.g. Intel x86 or Alpha 21064 in little-endian mode
+    # '00100020' on e.g. Motorola 68040
+
+If you need to distinguish between endian architectures you could use
+either of the variables set like so:
+
+    $is_big_endian   = unpack("h*", pack("s", 1)) =~ /01/;
+    $is_litte_endian = unpack("h*", pack("s", 1)) =~ /^1/;
+
 Differing widths can cause truncation even between platforms of equal
 endianness.  The platform of shorter width loses the upper parts of the
 number.  There is no good solution for this problem except to avoid
@@ -242,9 +255,13 @@ to be running the program.
     $file = catfile(curdir(), 'temp', 'file.txt');
     # on Unix and Win32, './temp/file.txt'
     # on Mac OS, ':temp:file.txt'
+    # on VMS, '[.temp]file.txt'
 
 File::Spec is available in the standard distribution as of version
-5.004_05.
+5.004_05.  File::Spec::Functions is only in File::Spec 0.7 and later,
+and some versions of perl come with version 0.6.  If File::Spec
+is not updated to 0.7 or later, you must use the object-oriented
+interface from File::Spec (or upgrade File::Spec).
 
 In general, production code should not have file paths hardcoded.
 Making them user-supplied or read from a configuration file is
@@ -317,7 +334,7 @@ Don't count on a specific environment variable existing in C<%ENV>.
 Don't count on C<%ENV> entries being case-sensitive, or even
 case-preserving.
 
-Don't count on signals for anything.
+Don't count on signals or C<%SIG> for anything.
 
 Don't count on filename globbing.  Use C<opendir>, C<readdir>, and
 C<closedir> instead.
@@ -511,7 +528,7 @@ a given module works on a given platform.
 
 =item Mailing list: cpan-testers@perl.org
 
-=item Testing results: C<http://www.perl.org/cpan-testers/>
+=item Testing results: C<http://testers.cpan.org/>
 
 =back
 
@@ -534,10 +551,11 @@ edited after the fact.
 Perl works on a bewildering variety of Unix and Unix-like platforms (see
 e.g. most of the files in the F<hints/> directory in the source code kit).
 On most of these systems, the value of C<$^O> (hence C<$Config{'osname'}>,
-too) is determined by lowercasing and stripping punctuation from the first
-field of the string returned by typing C<uname -a> (or a similar command)
-at the shell prompt.  Here, for example, are a few of the more popular
-Unix flavors:
+too) is determined either by lowercasing and stripping punctuation from the
+first field of the string returned by typing C<uname -a> (or a similar command)
+at the shell prompt or by testing the file system for the presence of
+uniquely named files such as a kernel or header file.  Here, for example,
+are a few of the more popular Unix flavors:
 
     uname         $^O        $Config{'archname'}
     --------------------------------------------
@@ -546,11 +564,16 @@ Unix flavors:
     dgux          dgux       AViiON-dgux
     DYNIX/ptx     dynixptx   i386-dynixptx
     FreeBSD       freebsd    freebsd-i386    
+    Linux         linux      arm-linux
     Linux         linux      i386-linux
     Linux         linux      i586-linux
     Linux         linux      ppc-linux
     HP-UX         hpux       PA-RISC1.1
     IRIX          irix       irix
+    Mac OS X      rhapsody   rhapsody
+    MachTen PPC   machten    powerpc-machten
+    NeXT 3        next       next-fat
+    NeXT 4        next       OPENSTEP-Mach
     openbsd       openbsd    i386-openbsd
     OSF1          dec_osf    alpha-dec_osf
     reliantunix-n svr4       RM400-svr4
@@ -625,6 +648,7 @@ DOSish perls are as follows:
     Windows NT    MSWin32    MSWin32-x86
     Windows NT    MSWin32    MSWin32-ALPHA
     Windows NT    MSWin32    MSWin32-ppc
+    Cygwin        cygwin
 
 Also see:
 
@@ -640,6 +664,13 @@ C<ftp://hobbes.nmsu.edu/pub/os2/dev/emx>
 
 =item The ActiveState Pages, C<http://www.activestate.com/>
 
+=item The Cygwin environment for Win32; F<README.cygwin> (installed 
+as L<perlcygwin>), C<http://sourceware.cygnus.com/cygwin/>
+
+=item The U/WIN environment for Win32,
+C<http://www.research.att.com/sw/tools/uwin/>
+
+
 =back
 
 =head2 S<Mac OS>
@@ -783,9 +814,9 @@ non-VMS platforms and can be helpful for conversions to and from RMS
 native formats.
 
 What C<\n> represents depends on the type of file opened.  It could
-be C<\015>, C<\012>, C<\015\012>, or nothing.  Reading from a file
-translates newlines to C<\012>, unless C<binmode> was executed on that
-handle, just like DOSish perls.
+be C<\015>, C<\012>, C<\015\012>, or nothing.  The VMS::Stdio module
+provides access to the special fopen() requirements of files with unusual
+attributes on VMS.
 
 TCP/IP stacks are optional on VMS, so socket routines might not be
 implemented.  UDP sockets may not be supported.
@@ -813,7 +844,7 @@ Also see:
 
 =over 4
 
-=item L<perlvms.pod>
+=item F<README.vms> (installed as L<README_vms>), L<perlvms>
 
 =item vmsperl list, C<majordomo@perl.org>
 
@@ -840,7 +871,8 @@ Even though VOS allows the slash character to appear in object
 names, because the VOS port of Perl interprets it as a pathname
 delimiting character, VOS files, directories, or links whose names
 contain a slash character cannot be processed.  Such files must be
-renamed before they can be processed by Perl.
+renamed before they can be processed by Perl.  Note that VOS limits
+file names to 32 or fewer characters.
 
 The following C functions are unimplemented on VOS, and any attempt by
 Perl to use them will result in a fatal error message and an immediate
@@ -853,7 +885,7 @@ The value of C<$^O> on VOS is "VOS".  To determine the architecture that
 you are running on without resorting to loading all of C<%Config> you
 can examine the content of the C<@INC> array like so:
 
-    if (grep(/VOS/, @INC)) {
+    if ($^O =~ /VOS/) {
         print "I'm on a Stratus box!\n";
     } else {
         print "I'm not on a Stratus box!\n";
@@ -864,20 +896,20 @@ can examine the content of the C<@INC> array like so:
         print "This box is a Stratus XA/R!\n";
 
     } elsif (grep(/7100/, @INC)) {
-        print "This box is a Stratus HP 7100 or 8000!\n";
+        print "This box is a Stratus HP 7100 or 8xxx!\n";
 
     } elsif (grep(/8000/, @INC)) {
-        print "This box is a Stratus HP 8000!\n";
+        print "This box is a Stratus HP 8xxx!\n";
 
     } else {
-        print "This box is a Stratus 68K...\n";
+        print "This box is a Stratus 68K!\n";
     }
 
 Also see:
 
 =over 4
 
-=item L<README.vos>
+=item F<README.vos>
 
 =item VOS mailing list
 
@@ -893,11 +925,12 @@ the message body to majordomo@list.stratagy.com.
 =head2 EBCDIC Platforms
 
 Recent versions of Perl have been ported to platforms such as OS/400 on
-AS/400 minicomputers as well as OS/390 & VM/ESA for IBM Mainframes.  Such
-computers use EBCDIC character sets internally (usually Character Code
-Set ID 00819 for OS/400 and IBM-1047 for OS/390 & VM/ESA).  On
-the mainframe perl currently works under the "Unix system services
-for OS/390" (formerly known as OpenEdition) and VM/ESA OpenEdition.
+AS/400 minicomputers as well as OS/390, VM/ESA, and BS2000 for S/390
+Mainframes.  Such computers use EBCDIC character sets internally (usually
+Character Code Set ID 0037 for OS/400 and either 1047 or POSIX-BC for S/390
+systems).  On the mainframe perl currently works under the "Unix system
+services for OS/390" (formerly known as OpenEdition), VM/ESA OpenEdition, or
+the BS200 POSIX-BC system (BS2000 is supported in perl 5.6 and greater).
 
 As of R2.5 of USS for OS/390 and Version 2.3 of VM/ESA these Unix
 sub-systems do not support the C<#!> shebang trick for script invocation.
@@ -911,6 +944,10 @@ similar to the following simple script:
 
     print "Hello from perl!\n";
 
+OS/390 will support the C<#!> shebang trick in release 2.8 and beyond.
+Calls to C<system> and backticks can use POSIX shell syntax on all
+S/390 systems.
+
 On the AS/400, if PERL5 is in your library list, you may need
 to wrap your perl scripts in a CL procedure to invoke them like so:
 
@@ -935,9 +972,14 @@ translate the C<\n> in the following statement to its ASCII equivalent
 
     print "Content-type: text/html\r\n\r\n";
 
-The value of C<$^O> on OS/390 is "os390".
+The values of C<$^O> on some of these platforms includes:
 
-The value of C<$^O> on VM/ESA is "vmesa".
+    uname         $^O        $Config{'archname'}
+    --------------------------------------------
+    OS/390        os390      os390
+    OS400         os400      os400
+    POSIX-BC      posix-bc   BS2000-posix-bc
+    VM/ESA        vmesa      vmesa
 
 Some simple tricks for determining if you are running on an EBCDIC
 platform could include any of the following (perhaps all):
@@ -957,6 +999,8 @@ Also see:
 
 =over 4
 
+=item F<README.os390>, F<README.posix-bc>, F<README.vmesa>
+
 =item perl-mvs list
 
 The perl-mvs@perl.org list is for discussion of porting issues as well as
@@ -964,6 +1008,7 @@ general usage issues for all EBCDIC Perls.  Send a message body of
 "subscribe perl-mvs" to majordomo@perl.org.
 
 =item AS/400 Perl information at C<http://as400.rochester.ibm.com/>
+as well as on CPAN in the F<ports/> directory.
 
 =back
 
@@ -1081,13 +1126,27 @@ for the likes of: aos, Atari ST, lynxos, riscos, Novell Netware,
 Tandem Guardian, I<etc.>  (Yes, we know that some of these OSes may
 fall under the Unix category, but we are not a standards body.)
 
+Some approximate operating system names and their C<$^O> values
+in the "OTHER" category include:
+
+    OS            $^O        $Config{'archname'}
+    ------------------------------------------
+    Amiga DOS     amigaos    m68k-amigos
+    MPE/iX        mpeix      PA-RISC1.1
+
 See also:
 
 =over 4
 
-=item Atari, Guido Flohr's page C<http://stud.uni-sb.de/~gufl0000/>
+=item Amiga, F<README.amiga> (installed as L<perlamiga>).
+
+=item Atari, F<README.mint> and Guido Flohr's web page
+C<http://stud.uni-sb.de/~gufl0000/>
+
+=item Be OS, F<README.beos>
 
-=item HP 300 MPE/iX  C<http://www.cccd.edu/~markb/perlix.html>
+=item HP 300 MPE/iX, F<README.mpeix> and Mark Bixby's web page
+C<http://www.cccd.edu/~markb/perlix.html>
 
 =item Novell Netware
 
@@ -1095,6 +1154,8 @@ A free perl5-based PERL.NLM for Novell Netware is available in
 precompiled binary and source code form from C<http://www.novell.com/>
 as well as from CPAN.
 
+=item Plan 9, F<README.plan9>
+
 =back
 
 =head1 FUNCTION IMPLEMENTATIONS
@@ -1342,11 +1403,11 @@ Not implemented. (Plan9, Win32, S<RISC OS>)
 
 =item endpwent
 
-Not implemented. (S<Mac OS>, Win32, VM/ESA)
+Not implemented. (S<Mac OS>, MPE/iX, VM/ESA, Win32)
 
 =item endgrent
 
-Not implemented. (S<Mac OS>, Win32, VMS, S<RISC OS>, VM/ESA)
+Not implemented. (S<Mac OS>, MPE/iX, S<RISC OS>, VM/ESA, VMS, Win32)
 
 =item endhostent
 
@@ -1393,21 +1454,24 @@ in the Winsock API does. (Win32)
 
 Available only for socket handles. (S<RISC OS>)
 
-=item kill LIST
+=item kill SIGNAL, LIST
 
 Not implemented, hence not useful for taint checking. (S<Mac OS>,
 S<RISC OS>)
 
-Available only for process handles returned by the C<system(1, ...)>
-method of spawning a process. (Win32)
+Unlike Unix platforms, C<kill(0, $pid)> will actually terminate
+the process.  (Win32)
 
 =item link OLDFILE,NEWFILE
 
-Not implemented. (S<Mac OS>, Win32, VMS, S<RISC OS>)
+Not implemented. (S<Mac OS>, MPE/iX, VMS, S<RISC OS>)
 
 Link count not updated because hard links are not quite that hard
 (They are sort of half-way between hard and soft links). (AmigaOS)
 
+Hard links are implemented on Win32 (Windows NT and Windows 2000)
+under NTFS only.
+
 =item lstat FILEHANDLE
 
 =item lstat EXPR
@@ -1435,7 +1499,7 @@ Not implemented. (S<Mac OS>, Win32, VMS, Plan9, S<RISC OS>, VOS)
 The C<|> variants are supported only if ToolServer is installed.
 (S<Mac OS>)
 
-open to C<|-> and C<-|> are unsupported. (S<Mac OS>, Win32, S<RISC OS>)
+open to C<|E<45>> and C<-|> are unsupported. (S<Mac OS>, Win32, S<RISC OS>)
 
 =item pipe READHANDLE,WRITEHANDLE
 
@@ -1463,6 +1527,10 @@ Only reliable on sockets. (S<RISC OS>)
 
 Not implemented. (S<Mac OS>, Win32, VMS, S<RISC OS>, VOS)
 
+=item setgrent
+
+Not implemented. (MPE/iX, Win32)
+
 =item setpgrp PID,PGRP
 
 Not implemented. (S<Mac OS>, Win32, VMS, S<RISC OS>, VOS)
@@ -1471,6 +1539,10 @@ Not implemented. (S<Mac OS>, Win32, VMS, S<RISC OS>, VOS)
 
 Not implemented. (S<Mac OS>, Win32, VMS, S<RISC OS>, VOS)
 
+=item setpwent
+
+Not implemented. (MPE/iX, Win32)
+
 =item setsockopt SOCKET,LEVEL,OPTNAME,OPTVAL
 
 Not implemented. (S<Mac OS>, Plan9)
@@ -1604,6 +1676,19 @@ Not useful. (S<RISC OS>)
 
 =over 4
 
+=item v1.46, 12 February 2000
+
+Updates for VOS and MPE/iX. (Peter Prymmer)  Other small changes.
+
+=item v1.45, 20 December 1999
+
+Small changes from 5.005_63 distribution, more changes to EBCDIC info.
+
+=item v1.44, 19 July 1999
+
+A bunch of updates from Peter Prymmer for C<$^O> values,
+endianness, File::Spec, VMS, BS2000, OS/400.
+
 =item v1.43, 24 May 1999
 
 Added a lot of cleaning up from Tom Christiansen.
@@ -1616,7 +1701,7 @@ Added notes about tests, sprintf/printf, and epoch offsets.
 
 Lots more little changes to formatting and content.
 
-Added a bunch of <$^O> and related values
+Added a bunch of C<$^O> and related values
 for various platforms; fixed mail and web addresses, and added
 and changed miscellaneous notes.  (Peter Prymmer)
 
@@ -1673,9 +1758,11 @@ Charles Bailey E<lt>bailey@newman.upenn.eduE<gt>,
 Graham Barr E<lt>gbarr@pobox.comE<gt>,
 Tom Christiansen E<lt>tchrist@perl.comE<gt>,
 Nicholas Clark E<lt>Nicholas.Clark@liverpool.ac.ukE<gt>,
+Thomas Dorner E<lt>Thomas.Dorner@start.deE<gt>,
 Andy Dougherty E<lt>doughera@lafcol.lafayette.eduE<gt>,
 Dominic Dunlop E<lt>domo@vo.luE<gt>,
-Neale Ferguson E<lt>neale@mailbox.tabnsw.com.auE<gt>
+Neale Ferguson E<lt>neale@mailbox.tabnsw.com.auE<gt>,
+David J. Fiander E<lt>davidf@mks.comE<gt>,
 Paul Green E<lt>Paul_Green@stratus.comE<gt>,
 M.J.T. Guy E<lt>mjtg@cus.cam.ac.ukE<gt>,
 Jarkko Hietaniemi E<lt>jhi@iki.fi<gt>,
@@ -1690,9 +1777,10 @@ Chris Nandor E<lt>pudge@pobox.comE<gt>,
 Matthias Neeracher E<lt>neeri@iis.ee.ethz.chE<gt>,
 Gary Ng E<lt>71564.1743@CompuServe.COME<gt>,
 Tom Phoenix E<lt>rootbeer@teleport.comE<gt>,
+AndrE<eacute> Pirard E<lt>A.Pirard@ulg.ac.beE<gt>,
 Peter Prymmer E<lt>pvhp@forte.comE<gt>,
 Hugo van der Sanden E<lt>hv@crypt0.demon.co.ukE<gt>,
-Gurusamy Sarathy E<lt>gsar@umich.eduE<gt>,
+Gurusamy Sarathy E<lt>gsar@activestate.comE<gt>,
 Paul J. Schinder E<lt>schinder@pobox.comE<gt>,
 Michael G Schwern E<lt>schwern@pobox.comE<gt>,
 Dan Sugalski E<lt>sugalskd@ous.eduE<gt>,
@@ -1703,4 +1791,4 @@ E<lt>pudge@pobox.comE<gt>.
 
 =head1 VERSION
 
-Version 1.43, last modified 24 May 1999
+Version 1.46, last modified 12 February 2000