X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperlport.pod;h=649623089ea9194323a00264b5cff8b9f22ca804;hb=b787fad4c79da06d28c957e5a9cb8faf91e91013;hp=5bf29d12d332b77cc60e54f91c322f4c77fa60d0;hpb=5970cde0ccf9e2bec07013f3ad3d1ebbbad9bd70;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/perlport.pod b/pod/perlport.pod index 5bf29d1..6496230 100644 --- a/pod/perlport.pod +++ b/pod/perlport.pod @@ -94,6 +94,26 @@ 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. +A common cause of unportable programs is the misuse of chop() to trim +newlines: + + # XXX UNPORTABLE! + while() { + chop; + @array = split(/:/); + #... + } + +You can get away with this on Unix and MacOS (they have a single +character end-of-line), but the same program will break under DOSish +perls because you're only chop()ing half the end-of-line. Instead, +chomp() should be used to trim newlines. The Dunce::Files module can +help audit your code for misuses of chop(). + +When dealing with binary files (or text files in binary mode) be sure +to explicitly set $/ to the appropriate value for your file format +before using chomp(). + Because of the "text" mode translation, DOSish perls have limitations in using C and C on a file accessed in "text" mode. Stick to C-ing to locations you got from C (and no @@ -181,10 +201,12 @@ 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, 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 and C formats C -and C, the "network" orders. These are guaranteed to be portable. +decimal), a big-endian host (Motorola, Sparc, PA) reads it as +0x78563412 (2018915346 in decimal). Alpha and MIPS can be either: +Digital/Compaq used/uses them in little-endian mode; SGI/Cray uses +them in big-endian mode. To avoid this problem in network (socket) +connections use the C and C formats C and C, 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: @@ -197,7 +219,7 @@ 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/; + $is_little_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 @@ -207,8 +229,8 @@ transferring or storing raw binary numbers. One can circumnavigate both these problems in two ways. Either transfer and store numbers always in text format, instead of raw binary, or else consider using modules like Data::Dumper (included in -the standard distribution as of Perl 5.005) and Storable. Keeping -all data as text significantly simplifies matters. +the standard distribution as of Perl 5.005) and Storable (included as +of perl 5.8). Keeping all data as text significantly simplifies matters. =head2 Files and Filesystems @@ -217,7 +239,7 @@ So, it is reasonably safe to assume that all platforms support the notion of a "path" to uniquely identify a file on the system. How that path is really written, though, differs considerably. -Atlhough similar, file path specifications differ between Unix, +Although similar, file path specifications differ between Unix, Windows, S, OS/2, VMS, VOS, S, and probably others. Unix, for example, is one of the few OSes that has the elegant idea of a single root directory. @@ -332,7 +354,10 @@ operating systems put mandatory locks on such files. 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. +case-preserving. Don't try to clear %ENV by saying C<%ENV = ();>, or, +if you really have to, make it conditional on C<$^O ne 'VMS'> since in +VMS the C<%ENV> table is much more than a per-process key-value string +table. Don't count on signals or C<%SIG> for anything. @@ -355,7 +380,7 @@ Commands that launch external processes are generally supported on most platforms (though many of them do not support any type of forking). The problem with using them arises from what you invoke them on. External tools are often named differently on different -platforms, may not be available in the same location, migth accept +platforms, may not be available in the same location, might accept different arguments, can behave differently, and often present their results in a platform-dependent way. Thus, you should seldom depend on them to produce consistent results. (Then again, if you're calling @@ -528,7 +553,7 @@ a given module works on a given platform. =item Mailing list: cpan-testers@perl.org -=item Testing results: C +=item Testing results: http://testers.cpan.org/ =back @@ -570,7 +595,7 @@ are a few of the more popular Unix flavors: Linux linux ppc-linux HP-UX hpux PA-RISC1.1 IRIX irix irix - Mac OS X rhapsody rhapsody + Mac OS X darwin darwin MachTen PPC machten powerpc-machten NeXT 3 next next-fat NeXT 4 next OPENSTEP-Mach @@ -650,26 +675,56 @@ DOSish perls are as follows: Windows NT MSWin32 MSWin32-ppc Cygwin cygwin +The various MSWin32 Perl's can distinguish the OS they are running on +via the value of the fifth element of the list returned from +Win32::GetOSVersion(). For example: + + if ($^O eq 'MSWin32') { + my @os_version_info = Win32::GetOSVersion(); + print +('3.1','95','NT')[$os_version_info[4]],"\n"; + } + Also see: =over 4 -=item The djgpp environment for DOS, C +=item * + +The djgpp environment for DOS, http://www.delorie.com/djgpp/ +and L. + +=item * + +The EMX environment for DOS, OS/2, etc. emx@iaehv.nl, +http://www.leo.org/pub/comp/os/os2/leo/gnu/emx+gcc/index.html or +ftp://hobbes.nmsu.edu/pub/os2/dev/emx. Also L. -=item The EMX environment for DOS, OS/2, etc. C, -C or -C +=item * -=item Build instructions for Win32, L. +Build instructions for Win32 in L, or under the Cygnus environment +in L. -=item The ActiveState Pages, C +=item * -=item The Cygwin environment for Win32; F (installed -as L), C +The C modules in L. -=item The U/WIN environment for Win32, -C +=item * +The ActiveState Pages, http://www.activestate.com/ + +=item * + +The Cygwin environment for Win32; F (installed +as L), http://www.cygwin.com/ + +=item * + +The U/WIN environment for Win32, +http://www.research.att.com/sw/tools/uwin/ + +=item * + +Build instructions for OS/2, L =back @@ -729,30 +784,32 @@ the application or MPW tool version is running, check: $is_ppc = $MacPerl::Architecture eq 'MacPPC'; $is_68k = $MacPerl::Architecture eq 'Mac68K'; -S and S, based on NeXT's OpenStep OS, will -(in theory) be able to run MacPerl natively, under the "Classic" -environment. The new "Cocoa" environment (formerly called the "Yellow Box") -may run a slightly modified version of MacPerl, using the Carbon interfaces. - -S and its Open Source version, Darwin, both run Unix -perl natively (with a few patches). Full support for these -is slated for perl 5.6. +S, based on NeXT's OpenStep OS, runs MacPerl natively, under the +"Classic" environment. There is no "Carbon" version of MacPerl to run +under the primary Mac OS X environment. S and its Open Source +version, Darwin, both run Unix perl natively. Also see: =over 4 -=item The MacPerl Pages, C. +=item * + +The MacPerl Pages, http://www.macperl.com/ . + +=item * + +The MacPerl mailing lists, http://www.macperl.org/ . -=item The MacPerl mailing lists, C. +=item * -=item MacPerl Module Porters, C. +MacPerl Module Porters, http://pudge.net/mmp/ . =back =head2 VMS -Perl on VMS is discussed in F in the perl distribution. +Perl on VMS is discussed in L in the perl distribution. Perl on VMS can accept either VMS- or Unix-style file specifications as in either of the following: @@ -813,10 +870,11 @@ process on VMS, is a pure Perl module that can easily be installed on 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. The VMS::Stdio module -provides access to the special fopen() requirements of files with unusual -attributes on VMS. +What C<\n> represents depends on the type of file opened. It usually +represents C<\012> but it could also be C<\015>, C<\012>, C<\015\012>, +C<\000>, C<\040>, or nothing depending on the file organiztion and +record format. 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. @@ -844,21 +902,27 @@ Also see: =over 4 -=item F (installed as L), L +=item * -=item vmsperl list, C +F (installed as L), L -Put the words C in message body. +=item * -=item vmsperl on the web, C +vmsperl list, majordomo@perl.org + +(Put the words C in message body.) + +=item * + +vmsperl on the web, http://www.sidhe.org/vmsperl/index.html =back =head2 VOS -Perl on VOS is discussed in F in the perl distribution. -Perl on VOS can accept either VOS- or Unix-style file -specifications as in either of the following: +Perl on VOS is discussed in F in the perl distribution +(installed as L). Perl on VOS can accept either VOS- or +Unix-style file specifications as in either of the following: $ perl -ne "print if /perl_setup/i" >system>notices $ perl -ne "print if /perl_setup/i" /system/notices @@ -874,16 +938,15 @@ contain a slash character cannot be processed. Such files must be 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 -exit from Perl: dup, do_aspawn, do_spawn, fork, waitpid. Once these -functions become available in the VOS POSIX.1 implementation, you can -either recompile and rebind Perl, or you can download a newer port from -ftp.stratus.com. +See F for restrictions that apply when Perl is built +with the alpha version of VOS POSIX.1 support. + +Perl on VOS is built without any extensions and does not support +dynamic loading. 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: +can examine the content of the @INC array like so: if ($^O =~ /VOS/) { print "I'm on a Stratus box!\n"; @@ -909,16 +972,22 @@ Also see: =over 4 -=item F +=item * -=item VOS mailing list +F + +=item * + +The VOS mailing list. There is no specific mailing list for Perl on VOS. You can post comments to the comp.sys.stratus newsgroup, or subscribe to the general Stratus mailing list. Send a letter with "Subscribe Info-Stratus" in the message body to majordomo@list.stratagy.com. -=item VOS Perl on the web at C +=item * + +VOS Perl on the web at http://ftp.stratus.com/pub/vos/vos.html =back @@ -931,6 +1000,7 @@ 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). +See L for details. 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. @@ -999,15 +1069,23 @@ Also see: =over 4 -=item F, F, F +=item * + +* + +L, F, F, F, +L. -=item perl-mvs list +=item * The perl-mvs@perl.org list is for discussion of porting issues as well as 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 +=item * + +AS/400 Perl information at +http://as400.rochester.ibm.com/ as well as on CPAN in the F directory. =back @@ -1138,23 +1216,33 @@ See also: =over 4 -=item Amiga, F (installed as L). +=item * + +Amiga, F (installed as L). + +=item * + +Atari, F and Guido Flohr's web page +http://stud.uni-sb.de/~gufl0000/ + +=item * -=item Atari, F and Guido Flohr's web page -C +Be OS, F -=item Be OS, F +=item * -=item HP 300 MPE/iX, F and Mark Bixby's web page -C +HP 300 MPE/iX, F and Mark Bixby's web page +http://www.bixby.org/mark/perlix.html -=item Novell Netware +=item * A free perl5-based PERL.NLM for Novell Netware is available in -precompiled binary and source code form from C +precompiled binary and source code form from http://www.novell.com/ as well as from CPAN. -=item Plan 9, F +=item * + +Plan 9, F =back @@ -1574,6 +1662,11 @@ Not implemented. (S, Plan9) Not implemented. (S, Win32, VMS, S, VOS) +=item sockatmark SOCKET + +A relatively recent addition to socket functions, may not +be implemented even in UNIX platforms. + =item socketpair SOCKET1,SOCKET2,DOMAIN,TYPE,PROTOCOL Not implemented. (S, Win32, VMS, S, VOS, VM/ESA) @@ -1584,6 +1677,10 @@ Not implemented. (S, Win32, VMS, S, VOS, VM/ESA) =item stat +Platforms that do not have rdev, blksize, or blocks will return these +as '', so numeric comparison or manipulation of these fields may cause +'not numeric' warnings. + mtime and atime are the same thing, and ctime is creation time instead of inode change time. (S) @@ -1594,6 +1691,9 @@ device and inode are not necessarily reliable. (VMS) mtime, atime and ctime all return the last modification time. Device and inode are not necessarily reliable. (S) +dev, rdev, blksize, and blocks are not available. inode is not +meaningful and will differ between stat calls on the same file. (os2) + =item symlink OLDFILE,NEWFILE Not implemented. (Win32, VMS, S) @@ -1690,7 +1790,7 @@ two seconds. (Win32) Not implemented. (S, VOS) Can only be applied to process handles returned for processes spawned -using C. (Win32) +using C or pseudo processes created with C. (Win32) Not useful. (S) @@ -1700,6 +1800,16 @@ Not useful. (S) =over 4 +=item v1.48, 02 February 2001 + +Various updates from perl5-porters over the past year, supported +platforms update from Jarkko Hietaniemi. + +=item v1.47, 22 March 2000 + +Various cleanups from Tom Christiansen, including migration of +long platform listings from L. + =item v1.46, 12 February 2000 Updates for VOS and MPE/iX. (Peter Prymmer) Other small changes. @@ -1777,96 +1887,97 @@ First public release with perl5.005. =head1 Supported Platforms -As of early March 2000 (the Perl release 5.6.0), the following +As of early 2001 (the Perl releases 5.6.1 and 5.7.1), the following platforms are able to build Perl from the standard source code distribution available at http://www.perl.com/CPAN/src/index.html AIX + AmigaOS + Darwin (Mac OS X) + DG/UX DOS DJGPP 1) + DYNIX/ptx + EPOC FreeBSD HP-UX IRIX Linux - LynxOS MachTen - MPE/iX - NetBSD + MacOS Classic 2) + NonStop-UX + ReliantUNIX (SINIX) OpenBSD + OpenVMS (VMS) OS/2 + OS X QNX - Rhapsody/Darwin 2) - SCO SV - SINIX Solaris - SVR4 - Tru64 UNIX 3) + Tru64 UNIX (DEC OSF/1, Digital UNIX) UNICOS UNICOS/mk - Unixware - VMS VOS - Windows 3.1 1) - Windows 95 1) 4) - Windows 98 1) 4) - Windows NT 1) 4) + Win32/NT/2K 3) 1) in DOS mode either the DOS or OS/2 ports can be used - 2) new in 5.6.0: the BSD/NeXT-based UNIX of Mac OS X - 3) formerly known as Digital UNIX and before that DEC OSF/1 - 4) compilers: Borland, Cygwin, Mingw32 EGCS/GCC, VC++ + 2) Mac OS Classic (pre-X) is almost 5.6.1-ready; building from + the source does work with 5.6.1, but additional MacOS specific + source code is needed for a complete build. Contact the mailing + list macperl-porters@macperl.org for more information. + 3) compilers: Borland, Cygwin, Mingw32 EGCS/GCC, VC++ -The following platforms worked for the previous major release -(5.005_03 being the latest maintenance release of that, as of early -March 2000), but be did not manage to test these in time for the 5.6.0 -release of Perl. There is a very good chance that these will work -just fine with 5.6.0. +The following platforms worked for the previous releases (5.6.0 and 5.7.0), +but we did not manage to test these in time for the 5.7.1 release. +There is a very good chance that these will work fine with the 5.7.1. - A/UX - BeOS - BSD/OS - DG/UX - DYNIX/ptx DomainOS Hurd - NextSTEP - OpenSTEP + LynxOS + MinGW + MPE/iX + NetBSD PowerMAX - SCO ODT/OSR + SCO SV SunOS - Ultrix + SVR4 + Unixware + Windows 3.1 + Windows 95 + Windows 98 + Windows Me -The following platform worked for the previous major release (5.005_03 -being the latest maintenance release of that, as of early March 2000). -However, standardization on UTF-8 as the internal string representation -in 5.6.0 has introduced incompatibilities in this EBCDIC platform. -Support for this platform may be enabled in a future release: +The following platform worked for the 5.005_03 major release but not +for 5.6.0. Standardization on UTF-8 as the internal string +representation in 5.6.0 and 5.6.1 introduced incompatibilities in this +EBCDIC platform. While Perl 5.7.1 will build on this platform some +regression tests may fail and the C pragma typically +introduces text handling errors. - OS390 1) + OS/390 1) - 1) Previously known as MVS, or OpenEdition MVS. + 1) previously known as MVS, about to become z/OS. -Strongly related to the OS390 platform by also being EBCDIC-based +Strongly related to the OS/390 platform by also being EBCDIC-based mainframe platforms are the following platforms: - BS2000 + POSIX-BC (BS2000) VM/ESA -These are also not expected to work under 5.6.0 for the same reasons -as OS390. Contact the mailing list perl-mvs@perl.org for more details. - -MacOS (Classic, pre-X) is almost 5.6.0-ready; building from the source -does work with 5.6.0, but additional MacOS specific source code is needed -for a complete port. Contact the mailing list macperl-porters@macperl.org -for more information. +These are also expected to work, albeit with no UTF-8 support, under 5.6.1 +for the same reasons as OS/390. Contact the mailing list perl-mvs@perl.org +for more details. The following platforms have been known to build Perl from source in -the past, but we haven't been able to verify their status for the -current release, either because the hardware/software platforms are -rare or because we don't have an active champion on these -platforms--or both: +the past (5.005_03 and earlier), but we haven't been able to verify +their status for the current release, either because the +hardware/software platforms are rare or because we don't have an +active champion on these platforms--or both. They used to work, +though, so go ahead and try compiling them, and let perlbug@perl.org +of any trouble. 3b1 - AmigaOS + A/UX + BeOS + BSD/OS ConvexOS CX/UX DC/OSx @@ -1883,16 +1994,21 @@ platforms--or both: MiNT MPC NEWS-OS + NextSTEP + OpenSTEP Opus Plan 9 PowerUX RISC/os + SCO ODT/OSR Stellar SVR2 TI1500 TitanOS + Ultrix Unisys Dynix Unixware + UTS Support for the following platform is planned for a future Perl release: @@ -1903,12 +2019,12 @@ binaries available via http://www.perl.com/CPAN/ports/index.html: Perl release - AS/400 5.003 Netware 5.003_07 + OS/400 5.005_02 Tandem Guardian 5.004 The following platforms have only binaries available via -http://www.perl.com/CPAN/ports/index.html: +http://www.perl.com/CPAN/ports/index.html : Perl release @@ -1921,24 +2037,33 @@ the source code, both for maximal configurability and for security, in case you are in a hurry you can check http://www.perl.com/CPAN/ports/index.html for binary distributions. +=head1 SEE ALSO + +L, L, L, L, L, +L, L, L, L, L, +L, L, L, L, L, +L, L, L, L, L, +L, L, L, L, +L, L, L, L, and L. + =head1 AUTHORS / CONTRIBUTORS -Abigail , +Abigail , Charles Bailey , Graham Barr , Tom Christiansen , -Nicholas Clark , +Nicholas Clark , Thomas Dorner , -Andy Dougherty , -Dominic Dunlop , -Neale Ferguson , +Andy Dougherty , +Dominic Dunlop , +Neale Ferguson , David J. Fiander , Paul Green , -M.J.T. Guy , -Jarkko Hietaniemi , +M.J.T. Guy , +Jarkko Hietaniemi , Luther Huffman , -Nick Ing-Simmons , -Andreas J. KEnig , +Nick Ing-Simmons , +Andreas J. KEnig , Markus Laker , Andrew M. Langmead , Larry Moore , @@ -1953,12 +2078,9 @@ Hugo van der Sanden , Gurusamy Sarathy , Paul J. Schinder , Michael G Schwern , -Dan Sugalski , +Dan Sugalski , Nathan Torkington . -This document is maintained by Chris Nandor -. - =head1 VERSION -Version 1.46, last modified 12 February 2000 +Version 1.50, last modified 10 Jul 2001