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.
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
$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
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.
=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
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'}
--------------------------------------------
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
Windows NT MSWin32 MSWin32-x86
Windows NT MSWin32 MSWin32-ALPHA
Windows NT MSWin32 MSWin32-ppc
+ Cygwin cygwin
Also see:
=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>
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.
=over 4
-=item L<perlvms.pod>
+=item F<README.vms> (installed as L<README_vms>), L<perlvms>
=item vmsperl list, C<majordomo@perl.org>
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
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";
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
=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.
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:
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):
=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
"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
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
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
=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
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
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
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)
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)
=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.
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)
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>,
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>,
=head1 VERSION
-Version 1.43, last modified 24 May 1999
+Version 1.46, last modified 12 February 2000