such as z/OS (OS/390) or OS/400 (using the ILE, the PASE is ASCII-based)
the above material is similar to "Unix" but the code numbers change:
- LF eq \025 eq \x15 eq chr(21) eq CP-1047 21
- LF eq \045 eq \x25 eq \cU eq chr(37) eq CP-0037 37
+ LF eq \025 eq \x15 eq \cU eq chr(21) eq CP-1047 21
+ LF eq \045 eq \x25 eq chr(37) eq CP-0037 37
CR eq \015 eq \x0D eq \cM eq chr(13) eq CP-1047 13
CR eq \015 eq \x0D eq \cM eq chr(13) eq CP-0037 13
connections use the C<pack> and C<unpack> formats C<n> and C<N>, the
"network" orders. These are guaranteed to be portable.
+As of perl 5.9.2, you can also use the C<E<gt>> and C<E<lt>> modifiers
+to force big- or little-endian byte-order. This is useful if you want
+to store signed integers or 64-bit integers, for example.
+
You can explore the endianness of your platform by unpacking a
data structure packed in native format such as:
if ($^O ne 'VMS')
{$thisperl .= $Config{_exe} unless $thisperl =~ m/$Config{_exe}$/i;}
+=head2 Networking
+
+Don't assume that you can reach the public Internet.
+
+Don't assume that there is only one way to get through firewalls
+to the public Internet.
+
+Don't assume that you can reach outside world through any other port
+than 80, or some web proxy. ftp is blocked by many firewalls.
+
+Don't assume that you can send email by connecting to the local SMTP port.
+
+Don't assume that you can reach yourself or any node by the name
+'localhost'. The same goes for '127.0.0.1'. You will have to try both.
+
+Don't assume that the host has only one network card, or that it
+can't bind to many virtual IP addresses.
+
+Don't assume a particular network device name.
+
+Don't assume a particular set of ioctl()s will work.
+
+Don't assume that you can ping hosts and get replies.
+
+Don't assume that any particular port (service) will respond.
+
+Don't assume that Sys::Hostname() (or any other API or command)
+returns either a fully qualified hostname or a non-qualified hostname:
+it all depends on how the system had been configured. Also remember
+things like DHCP and NAT-- the hostname you get back might not be very
+useful.
+
+All the above "don't":s may look daunting, and they are -- but the key
+is to degrade gracefully if one cannot reach the particular network
+service one wants. Croaking or hanging do not look very professional.
+
=head2 Interprocess Communication (IPC)
In general, don't directly access the system in code meant to be
some large number. C<$offset> can then be added to a Unix time value
to get what should be the proper value on any system.
+On Windows (at least), you shouldn't pass a negative value to C<gmtime> or
+C<localtime>.
+
=head2 Character sets and character encoding
Assume very little about character sets.
If you really want to be international, you should consider Unicode.
See L<perluniintro> and L<perlunicode> for more information.
+If you want to use non-ASCII bytes (outside the bytes 0x00..0x7f) in
+the "source code" of your code, to be portable you have to be explicit
+about what bytes they are. Someone might for example be using your
+code under a UTF-8 locale, in which case random native bytes might be
+illegal ("Malformed UTF-8 ...") This means that for example embedding
+ISO 8859-1 bytes beyond 0x7f into your strings might cause trouble
+later. If the bytes are native 8-bit bytes, you can use the C<bytes>
+pragma. If the bytes are in a string (regular expression being a
+curious string), you can often also use the C<\xHH> notation instead
+of embedding the bytes as-is. If they are in some particular legacy
+encoding (ether single-byte or something more complicated), you can
+use the C<encoding> pragma. (If you want to write your code in UTF-8,
+you can use either the C<utf8> pragma, or the C<encoding> pragma.)
+The C<bytes> and C<utf8> pragmata are available since Perl 5.6.0, and
+the C<encoding> pragma since Perl 5.8.0.
+
=head2 System Resources
If your code is destined for systems with severely constrained (or
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
+C<\000>, C<\040>, or nothing depending on the file organization and
record format. The VMS::Stdio module provides access to the
special fopen() requirements of files with unusual attributes on VMS.
C<-x> (or C<-X>) determine if a file has an executable file type.
(S<RISC OS>)
-=item alarm SECONDS
-
-=item alarm
-
-Not implemented. (Win32)
-
=item binmode FILEHANDLE
Meaningless. (S<Mac OS>, S<RISC OS>)
Not implemented. (S<Mac OS>, Win32, VMS, VM/ESA)
+=item gethostbyname
+
+C<gethostbyname('localhost')> does not work everywhere: you may have
+to use C<gethostbyname('127.0.0.1')>. (S<Mac OS>, S<Irix 5>)
+
=item gethostent
Not implemented. (S<Mac OS>, Win32)
AIX
BeOS
+ BSD/OS (BSDi)
Cygwin
DG/UX
DOS DJGPP 1)
DYNIX/ptx
EPOC R5
FreeBSD
+ HI-UXMPP (Hitachi) (5.8.0 worked but we didn't know it)
HP-UX
IRIX
Linux
Mac OS Classic
- Mac OS X (Darwin)
+ Mac OS X (Darwin)
MPE/iX
NetBSD
NetWare
NonStop-UX
- ReliantUNIX (SINIX)
+ ReliantUNIX (formerly SINIX)
OpenBSD
- OpenVMS (VMS)
+ OpenVMS (formerly VMS)
+ Open UNIX (Unixware) (since Perl 5.8.1/5.9.0)
OS/2
OS/400 (using the PASE) (since Perl 5.8.1/5.9.0)
PowerUX
- POSIX-BC (BS2000)
+ POSIX-BC (formerly BS2000)
QNX
Solaris
SunOS 4
- SUPER-UX
- Tru64 UNIX (DEC OSF/1, Digital UNIX)
+ SUPER-UX (NEC)
+ Tru64 UNIX (formerly DEC OSF/1, Digital UNIX)
UNICOS
UNICOS/mk
UTS
VOS
Win95/98/ME/2K/XP 2)
WinCE
- z/OS (OS/390)
+ z/OS (formerly OS/390)
VM/ESA
1) in DOS mode either the DOS or OS/2 ports can be used
L<perlaix>, L<perlamiga>, L<perlapollo>, L<perlbeos>, L<perlbs2000>,
L<perlce>, L<perlcygwin>, L<perldgux>, L<perldos>, L<perlepoc>,
L<perlebcdic>, L<perlfreebsd>, L<perlhurd>, L<perlhpux>, L<perlirix>,
-L<perlmachten>, L<perlmacos>, L<perlmint>, L<perlmpeix>,
+L<perlmachten>, L<perlmacos>, L<perlmacosx>, L<perlmint>, L<perlmpeix>,
L<perlnetware>, L<perlos2>, L<perlos390>, L<perlos400>,
L<perlplan9>, L<perlqnx>, L<perlsolaris>, L<perltru64>,
L<perlunicode>, L<perlvmesa>, L<perlvms>, L<perlvos>,