| 1 |
.\" -*- mode: troff; coding: utf-8 -*- |
| 2 |
.\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) |
| 3 |
.\" |
| 4 |
.\" Standard preamble: |
| 5 |
.\" ======================================================================== |
| 6 |
.de Sp \" Vertical space (when we can't use .PP) |
| 7 |
.if t .sp .5v |
| 8 |
.if n .sp |
| 9 |
.. |
| 10 |
.de Vb \" Begin verbatim text |
| 11 |
.ft CW |
| 12 |
.nf |
| 13 |
.ne \\$1 |
| 14 |
.. |
| 15 |
.de Ve \" End verbatim text |
| 16 |
.ft R |
| 17 |
.fi |
| 18 |
.. |
| 19 |
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. |
| 20 |
.ie n \{\ |
| 21 |
. ds C` "" |
| 22 |
. ds C' "" |
| 23 |
'br\} |
| 24 |
.el\{\ |
| 25 |
. ds C` |
| 26 |
. ds C' |
| 27 |
'br\} |
| 28 |
.\" |
| 29 |
.\" Escape single quotes in literal strings from groff's Unicode transform. |
| 30 |
.ie \n(.g .ds Aq \(aq |
| 31 |
.el .ds Aq ' |
| 32 |
.\" |
| 33 |
.\" If the F register is >0, we'll generate index entries on stderr for |
| 34 |
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index |
| 35 |
.\" entries marked with X<> in POD. Of course, you'll have to process the |
| 36 |
.\" output yourself in some meaningful fashion. |
| 37 |
.\" |
| 38 |
.\" Avoid warning from groff about undefined register 'F'. |
| 39 |
.de IX |
| 40 |
.. |
| 41 |
.nr rF 0 |
| 42 |
.if \n(.g .if rF .nr rF 1 |
| 43 |
.if (\n(rF:(\n(.g==0)) \{\ |
| 44 |
. if \nF \{\ |
| 45 |
. de IX |
| 46 |
. tm Index:\\$1\t\\n%\t"\\$2" |
| 47 |
.. |
| 48 |
. if !\nF==2 \{\ |
| 49 |
. nr % 0 |
| 50 |
. nr F 2 |
| 51 |
. \} |
| 52 |
. \} |
| 53 |
.\} |
| 54 |
.rr rF |
| 55 |
.\" ======================================================================== |
| 56 |
.\" |
| 57 |
.IX Title "PERLPORT 1" |
| 58 |
.TH PERLPORT 1 2025-11-16 "perl v5.40.1" "Perl Programmers Reference Guide" |
| 59 |
.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 60 |
.\" way too many mistakes in technical documents. |
| 61 |
.if n .ad l |
| 62 |
.nh |
| 63 |
.SH NAME |
| 64 |
perlport \- Writing portable Perl |
| 65 |
.SH DESCRIPTION |
| 66 |
.IX Header "DESCRIPTION" |
| 67 |
Perl runs on numerous operating systems. While most of them share |
| 68 |
much in common, they also have their own unique features. |
| 69 |
.PP |
| 70 |
This document is meant to help you to find out what constitutes portable |
| 71 |
Perl code. That way once you make a decision to write portably, |
| 72 |
you know where the lines are drawn, and you can stay within them. |
| 73 |
.PP |
| 74 |
There is a tradeoff between taking full advantage of one particular |
| 75 |
type of computer and taking advantage of a full range of them. |
| 76 |
Naturally, as you broaden your range and become more diverse, the |
| 77 |
common factors drop, and you are left with an increasingly smaller |
| 78 |
area of common ground in which you can operate to accomplish a |
| 79 |
particular task. Thus, when you begin attacking a problem, it is |
| 80 |
important to consider under which part of the tradeoff curve you |
| 81 |
want to operate. Specifically, you must decide whether it is |
| 82 |
important that the task that you are coding has the full generality |
| 83 |
of being portable, or whether to just get the job done right now. |
| 84 |
This is the hardest choice to be made. The rest is easy, because |
| 85 |
Perl provides many choices, whichever way you want to approach your |
| 86 |
problem. |
| 87 |
.PP |
| 88 |
Looking at it another way, writing portable code is usually about |
| 89 |
willfully limiting your available choices. Naturally, it takes |
| 90 |
discipline and sacrifice to do that. The product of portability |
| 91 |
and convenience may be a constant. You have been warned. |
| 92 |
.PP |
| 93 |
Be aware of two important points: |
| 94 |
.IP "Not all Perl programs have to be portable" 4 |
| 95 |
.IX Item "Not all Perl programs have to be portable" |
| 96 |
There is no reason you should not use Perl as a language to glue Unix |
| 97 |
tools together, or to prototype a Macintosh application, or to manage the |
| 98 |
Windows registry. If it makes no sense to aim for portability for one |
| 99 |
reason or another in a given program, then don't bother. |
| 100 |
.IP "Nearly all of Perl already \fIis\fR portable" 4 |
| 101 |
.IX Item "Nearly all of Perl already is portable" |
| 102 |
Don't be fooled into thinking that it is hard to create portable Perl |
| 103 |
code. It isn't. Perl tries its level-best to bridge the gaps between |
| 104 |
what's available on different platforms, and all the means available to |
| 105 |
use those features. Thus almost all Perl code runs on any machine |
| 106 |
without modification. But there are some significant issues in |
| 107 |
writing portable code, and this document is entirely about those issues. |
| 108 |
.PP |
| 109 |
Here's the general rule: When you approach a task commonly done |
| 110 |
using a whole range of platforms, think about writing portable |
| 111 |
code. That way, you don't sacrifice much by way of the implementation |
| 112 |
choices you can avail yourself of, and at the same time you can give |
| 113 |
your users lots of platform choices. On the other hand, when you have to |
| 114 |
take advantage of some unique feature of a particular platform, as is |
| 115 |
often the case with systems programming (whether for Unix, Windows, |
| 116 |
VMS, etc.), consider writing platform-specific code. |
| 117 |
.PP |
| 118 |
When the code will run on only two or three operating systems, you |
| 119 |
may need to consider only the differences of those particular systems. |
| 120 |
The important thing is to decide where the code will run and to be |
| 121 |
deliberate in your decision. |
| 122 |
.PP |
| 123 |
The material below is separated into three main sections: main issues of |
| 124 |
portability ("ISSUES"), platform-specific issues ("PLATFORMS"), and |
| 125 |
built-in Perl functions that behave differently on various ports |
| 126 |
("FUNCTION IMPLEMENTATIONS"). |
| 127 |
.PP |
| 128 |
This information should not be considered complete; it includes possibly |
| 129 |
transient information about idiosyncrasies of some of the ports, almost |
| 130 |
all of which are in a state of constant evolution. Thus, this material |
| 131 |
should be considered a perpetual work in progress |
| 132 |
(\f(CW\*(C`<IMG SRC="yellow_sign.gif" ALT="Under Construction">\*(C'\fR). |
| 133 |
.SH ISSUES |
| 134 |
.IX Header "ISSUES" |
| 135 |
.SS Newlines |
| 136 |
.IX Subsection "Newlines" |
| 137 |
In most operating systems, lines in files are terminated by newlines. |
| 138 |
Just what is used as a newline may vary from OS to OS. Unix |
| 139 |
traditionally uses \f(CW\*(C`\e012\*(C'\fR, one type of DOSish I/O uses \f(CW\*(C`\e015\e012\*(C'\fR, |
| 140 |
Mac\ OS uses \f(CW\*(C`\e015\*(C'\fR, and z/OS uses \f(CW\*(C`\e025\*(C'\fR. |
| 141 |
.PP |
| 142 |
Perl uses \f(CW\*(C`\en\*(C'\fR to represent the "logical" newline, where what is |
| 143 |
logical may depend on the platform in use. In MacPerl, \f(CW\*(C`\en\*(C'\fR always |
| 144 |
means \f(CW\*(C`\e015\*(C'\fR. On EBCDIC platforms, \f(CW\*(C`\en\*(C'\fR could be \f(CW\*(C`\e025\*(C'\fR or \f(CW\*(C`\e045\*(C'\fR. |
| 145 |
In DOSish perls, \f(CW\*(C`\en\*(C'\fR usually means \f(CW\*(C`\e012\*(C'\fR, but when |
| 146 |
accessing a file in "text" mode, perl uses the \f(CW\*(C`:crlf\*(C'\fR layer that |
| 147 |
translates it to (or from) \f(CW\*(C`\e015\e012\*(C'\fR, depending on whether you're |
| 148 |
reading or writing. Unix does the same thing on ttys in canonical |
| 149 |
mode. \f(CW\*(C`\e015\e012\*(C'\fR is commonly referred to as CRLF. |
| 150 |
.PP |
| 151 |
To trim trailing newlines from text lines use |
| 152 |
\&\f(CW\*(C`chomp\*(C'\fR. With default settings that function |
| 153 |
looks for a trailing \f(CW\*(C`\en\*(C'\fR character and thus trims in a portable way. |
| 154 |
.PP |
| 155 |
When dealing with binary files (or text files in binary mode) be sure |
| 156 |
to explicitly set \f(CW$/\fR to the appropriate value for |
| 157 |
your file format before using \f(CW\*(C`chomp\*(C'\fR. |
| 158 |
.PP |
| 159 |
Because of the "text" mode translation, DOSish perls have limitations in |
| 160 |
using \f(CW\*(C`seek\*(C'\fR and |
| 161 |
\&\f(CW\*(C`tell\*(C'\fR on a file accessed in "text" mode. |
| 162 |
Stick to \f(CW\*(C`seek\*(C'\fR\-ing to |
| 163 |
locations you got from \f(CW\*(C`tell\*(C'\fR (and no |
| 164 |
others), and you are usually free to use |
| 165 |
\&\f(CW\*(C`seek\*(C'\fR and |
| 166 |
\&\f(CW\*(C`tell\*(C'\fR even in "text" mode. Using |
| 167 |
\&\f(CW\*(C`seek\*(C'\fR or |
| 168 |
\&\f(CW\*(C`tell\*(C'\fR or other file operations may be |
| 169 |
non-portable. If you use \f(CW\*(C`binmode\*(C'\fR on a |
| 170 |
file, however, you can usually |
| 171 |
\&\f(CW\*(C`seek\*(C'\fR and |
| 172 |
\&\f(CW\*(C`tell\*(C'\fR with arbitrary values safely. |
| 173 |
.PP |
| 174 |
A common misconception in socket programming is that \f(CW\*(C`\en\ eq\ \e012\*(C'\fR |
| 175 |
everywhere. When using protocols such as common Internet protocols, |
| 176 |
\&\f(CW\*(C`\e012\*(C'\fR and \f(CW\*(C`\e015\*(C'\fR are called for specifically, and the values of |
| 177 |
the logical \f(CW\*(C`\en\*(C'\fR and \f(CW\*(C`\er\*(C'\fR (carriage return) are not reliable. |
| 178 |
.PP |
| 179 |
.Vb 2 |
| 180 |
\& print $socket "Hi there, client!\er\en"; # WRONG |
| 181 |
\& print $socket "Hi there, client!\e015\e012"; # RIGHT |
| 182 |
.Ve |
| 183 |
.PP |
| 184 |
However, using \f(CW\*(C`\e015\e012\*(C'\fR (or \f(CW\*(C`\ecM\ecJ\*(C'\fR, or \f(CW\*(C`\ex0D\ex0A\*(C'\fR) can be tedious |
| 185 |
and unsightly, as well as confusing to those maintaining the code. As |
| 186 |
such, the \f(CW\*(C`Socket\*(C'\fR module supplies the Right Thing for those |
| 187 |
who want it. |
| 188 |
.PP |
| 189 |
.Vb 2 |
| 190 |
\& use Socket qw(:DEFAULT :crlf); |
| 191 |
\& print $socket "Hi there, client!$CRLF" # RIGHT |
| 192 |
.Ve |
| 193 |
.PP |
| 194 |
When reading from a socket, remember that the default input record |
| 195 |
separator \f(CW$/\fR is \f(CW\*(C`\en\*(C'\fR, but robust socket code |
| 196 |
will recognize as either \f(CW\*(C`\e012\*(C'\fR or \f(CW\*(C`\e015\e012\*(C'\fR as end of line: |
| 197 |
.PP |
| 198 |
.Vb 3 |
| 199 |
\& while (<$socket>) { # NOT ADVISABLE! |
| 200 |
\& # ... |
| 201 |
\& } |
| 202 |
.Ve |
| 203 |
.PP |
| 204 |
Because both CRLF and LF end in LF, the input record separator can |
| 205 |
be set to LF and any CR stripped later. Better to write: |
| 206 |
.PP |
| 207 |
.Vb 2 |
| 208 |
\& use Socket qw(:DEFAULT :crlf); |
| 209 |
\& local($/) = LF; # not needed if $/ is already \e012 |
| 210 |
\& |
| 211 |
\& while (<$socket>) { |
| 212 |
\& s/$CR?$LF/\en/; # not sure if socket uses LF or CRLF, OK |
| 213 |
\& # s/\e015?\e012/\en/; # same thing |
| 214 |
\& } |
| 215 |
.Ve |
| 216 |
.PP |
| 217 |
This example is preferred over the previous one\-\-even for Unix |
| 218 |
platforms\-\-because now any \f(CW\*(C`\e015\*(C'\fR's (\f(CW\*(C`\ecM\*(C'\fR's) are stripped out |
| 219 |
(and there was much rejoicing). |
| 220 |
.PP |
| 221 |
Similarly, functions that return text data\-\-such as a function that |
| 222 |
fetches a web page\-\-should sometimes translate newlines before |
| 223 |
returning the data, if they've not yet been translated to the local |
| 224 |
newline representation. A single line of code will often suffice: |
| 225 |
.PP |
| 226 |
.Vb 2 |
| 227 |
\& $data =~ s/\e015?\e012/\en/g; |
| 228 |
\& return $data; |
| 229 |
.Ve |
| 230 |
.PP |
| 231 |
Some of this may be confusing. Here's a handy reference to the ASCII CR |
| 232 |
and LF characters. You can print it out and stick it in your wallet. |
| 233 |
.PP |
| 234 |
.Vb 2 |
| 235 |
\& LF eq \e012 eq \ex0A eq \ecJ eq chr(10) eq ASCII 10 |
| 236 |
\& CR eq \e015 eq \ex0D eq \ecM eq chr(13) eq ASCII 13 |
| 237 |
\& |
| 238 |
\& | Unix | DOS | Mac | |
| 239 |
\& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- |
| 240 |
\& \en | LF | LF | CR | |
| 241 |
\& \er | CR | CR | LF | |
| 242 |
\& \en * | LF | CRLF | CR | |
| 243 |
\& \er * | CR | CR | LF | |
| 244 |
\& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- |
| 245 |
\& * text\-mode STDIO |
| 246 |
.Ve |
| 247 |
.PP |
| 248 |
The Unix column assumes that you are not accessing a serial line |
| 249 |
(like a tty) in canonical mode. If you are, then CR on input becomes |
| 250 |
"\en", and "\en" on output becomes CRLF. |
| 251 |
.PP |
| 252 |
These are just the most common definitions of \f(CW\*(C`\en\*(C'\fR and \f(CW\*(C`\er\*(C'\fR in Perl. |
| 253 |
There may well be others. For example, on an EBCDIC implementation |
| 254 |
such as z/OS (OS/390) or OS/400 (using the ILE, the PASE is ASCII-based) |
| 255 |
the above material is similar to "Unix" but the code numbers change: |
| 256 |
.PP |
| 257 |
.Vb 4 |
| 258 |
\& LF eq \e025 eq \ex15 eq \ecU eq chr(21) eq CP\-1047 21 |
| 259 |
\& LF eq \e045 eq \ex25 eq chr(37) eq CP\-0037 37 |
| 260 |
\& CR eq \e015 eq \ex0D eq \ecM eq chr(13) eq CP\-1047 13 |
| 261 |
\& CR eq \e015 eq \ex0D eq \ecM eq chr(13) eq CP\-0037 13 |
| 262 |
\& |
| 263 |
\& | z/OS | OS/400 | |
| 264 |
\& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- |
| 265 |
\& \en | LF | LF | |
| 266 |
\& \er | CR | CR | |
| 267 |
\& \en * | LF | LF | |
| 268 |
\& \er * | CR | CR | |
| 269 |
\& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- |
| 270 |
\& * text\-mode STDIO |
| 271 |
.Ve |
| 272 |
.SS "Numbers endianness and Width" |
| 273 |
.IX Subsection "Numbers endianness and Width" |
| 274 |
Different CPUs store integers and floating point numbers in different |
| 275 |
orders (called \fIendianness\fR) and widths (32\-bit and 64\-bit being the |
| 276 |
most common today). This affects your programs when they attempt to transfer |
| 277 |
numbers in binary format from one CPU architecture to another, |
| 278 |
usually either "live" via network connection, or by storing the |
| 279 |
numbers to secondary storage such as a disk file or tape. |
| 280 |
.PP |
| 281 |
Conflicting storage orders make an utter mess out of the numbers. If a |
| 282 |
little-endian host (Intel, VAX) stores 0x12345678 (305419896 in |
| 283 |
decimal), a big-endian host (Motorola, Sparc, PA) reads it as |
| 284 |
0x78563412 (2018915346 in decimal). Alpha and MIPS can be either: |
| 285 |
Digital/Compaq used/uses them in little-endian mode; SGI/Cray uses |
| 286 |
them in big-endian mode. To avoid this problem in network (socket) |
| 287 |
connections use the \f(CW\*(C`pack\*(C'\fR and |
| 288 |
\&\f(CW\*(C`unpack\*(C'\fR formats \f(CW\*(C`n\*(C'\fR and \f(CW\*(C`N\*(C'\fR, the |
| 289 |
"network" orders. These are guaranteed to be portable. |
| 290 |
.PP |
| 291 |
As of Perl 5.10.0, you can also use the \f(CW\*(C`>\*(C'\fR and \f(CW\*(C`<\*(C'\fR modifiers |
| 292 |
to force big\- or little-endian byte-order. This is useful if you want |
| 293 |
to store signed integers or 64\-bit integers, for example. |
| 294 |
.PP |
| 295 |
You can explore the endianness of your platform by unpacking a |
| 296 |
data structure packed in native format such as: |
| 297 |
.PP |
| 298 |
.Vb 3 |
| 299 |
\& print unpack("h*", pack("s2", 1, 2)), "\en"; |
| 300 |
\& # \*(Aq10002000\*(Aq on e.g. Intel x86 or Alpha 21064 in little\-endian mode |
| 301 |
\& # \*(Aq00100020\*(Aq on e.g. Motorola 68040 |
| 302 |
.Ve |
| 303 |
.PP |
| 304 |
If you need to distinguish between endian architectures you could use |
| 305 |
either of the variables set like so: |
| 306 |
.PP |
| 307 |
.Vb 2 |
| 308 |
\& $is_big_endian = unpack("h*", pack("s", 1)) =~ /01/; |
| 309 |
\& $is_little_endian = unpack("h*", pack("s", 1)) =~ /^1/; |
| 310 |
.Ve |
| 311 |
.PP |
| 312 |
Differing widths can cause truncation even between platforms of equal |
| 313 |
endianness. The platform of shorter width loses the upper parts of the |
| 314 |
number. There is no good solution for this problem except to avoid |
| 315 |
transferring or storing raw binary numbers. |
| 316 |
.PP |
| 317 |
One can circumnavigate both these problems in two ways. Either |
| 318 |
transfer and store numbers always in text format, instead of raw |
| 319 |
binary, or else consider using modules like |
| 320 |
\&\f(CW\*(C`Data::Dumper\*(C'\fR and \f(CW\*(C`Storable\*(C'\fR (included as |
| 321 |
of Perl 5.8). Keeping all data as text significantly simplifies matters. |
| 322 |
.SS "Files and Filesystems" |
| 323 |
.IX Subsection "Files and Filesystems" |
| 324 |
Most platforms these days structure files in a hierarchical fashion. |
| 325 |
So, it is reasonably safe to assume that all platforms support the |
| 326 |
notion of a "path" to uniquely identify a file on the system. How |
| 327 |
that path is really written, though, differs considerably. |
| 328 |
.PP |
| 329 |
Although similar, file path specifications differ between Unix, |
| 330 |
Windows, Mac\ OS, OS/2, VMS, VOS, RISC\ OS, and probably others. |
| 331 |
Unix, for example, is one of the few OSes that has the elegant idea |
| 332 |
of a single root directory. |
| 333 |
.PP |
| 334 |
DOS, OS/2, VMS, VOS, and Windows can work similarly to Unix with \f(CW\*(C`/\*(C'\fR |
| 335 |
as path separator, or in their own idiosyncratic ways (such as having |
| 336 |
several root directories and various "unrooted" device files such NIL: |
| 337 |
and LPT:). |
| 338 |
.PP |
| 339 |
Mac\ OS 9 and earlier used \f(CW\*(C`:\*(C'\fR as a path separator instead of \f(CW\*(C`/\*(C'\fR. |
| 340 |
.PP |
| 341 |
The filesystem may support neither hard links |
| 342 |
(\f(CW\*(C`link\*(C'\fR) nor symbolic links |
| 343 |
(\f(CW\*(C`symlink\*(C'\fR, |
| 344 |
\&\f(CW\*(C`readlink\*(C'\fR, |
| 345 |
\&\f(CW\*(C`lstat\*(C'\fR). |
| 346 |
.PP |
| 347 |
The filesystem may support neither access timestamp nor change |
| 348 |
timestamp (meaning that about the only portable timestamp is the |
| 349 |
modification timestamp), or one second granularity of any timestamps |
| 350 |
(e.g. the FAT filesystem limits the time granularity to two seconds). |
| 351 |
.PP |
| 352 |
The "inode change timestamp" (the \f(CW\*(C`\-C\*(C'\fR |
| 353 |
filetest) may really be the "creation timestamp" (which it is not in |
| 354 |
Unix). |
| 355 |
.PP |
| 356 |
VOS perl can emulate Unix filenames with \f(CW\*(C`/\*(C'\fR as path separator. The |
| 357 |
native pathname characters greater-than, less-than, number-sign, and |
| 358 |
percent-sign are always accepted. |
| 359 |
.PP |
| 360 |
RISC\ OS perl can emulate Unix filenames with \f(CW\*(C`/\*(C'\fR as path |
| 361 |
separator, or go native and use \f(CW\*(C`.\*(C'\fR for path separator and \f(CW\*(C`:\*(C'\fR to |
| 362 |
signal filesystems and disk names. |
| 363 |
.PP |
| 364 |
Don't assume Unix filesystem access semantics: that read, write, |
| 365 |
and execute are all the permissions there are, and even if they exist, |
| 366 |
that their semantics (for example what do \f(CW\*(C`r\*(C'\fR, \f(CW\*(C`w\*(C'\fR, and \f(CW\*(C`x\*(C'\fR mean on |
| 367 |
a directory) are the Unix ones. The various Unix/POSIX compatibility |
| 368 |
layers usually try to make interfaces like \f(CW\*(C`chmod\*(C'\fR |
| 369 |
work, but sometimes there simply is no good mapping. |
| 370 |
.PP |
| 371 |
The \f(CW\*(C`File::Spec\*(C'\fR modules provide methods to manipulate path |
| 372 |
specifications and return the results in native format for each |
| 373 |
platform. This is often unnecessary as Unix-style paths are |
| 374 |
understood by Perl on every supported platform, but if you need to |
| 375 |
produce native paths for a native utility that does not understand |
| 376 |
Unix syntax, or if you are operating on paths or path components |
| 377 |
in unknown (and thus possibly native) syntax, \f(CW\*(C`File::Spec\*(C'\fR |
| 378 |
is your friend. Here are two brief examples: |
| 379 |
.PP |
| 380 |
.Vb 2 |
| 381 |
\& use File::Spec::Functions; |
| 382 |
\& chdir(updir()); # go up one directory |
| 383 |
\& |
| 384 |
\& # Concatenate a path from its components |
| 385 |
\& my $file = catfile(updir(), \*(Aqtemp\*(Aq, \*(Aqfile.txt\*(Aq); |
| 386 |
\& # on Unix: \*(Aq../temp/file.txt\*(Aq |
| 387 |
\& # on Win32: \*(Aq..\etemp\efile.txt\*(Aq |
| 388 |
\& # on VMS: \*(Aq[\-.temp]file.txt\*(Aq |
| 389 |
.Ve |
| 390 |
.PP |
| 391 |
In general, production code should not have file paths hardcoded. |
| 392 |
Making them user-supplied or read from a configuration file is |
| 393 |
better, keeping in mind that file path syntax varies on different |
| 394 |
machines. |
| 395 |
.PP |
| 396 |
This is especially noticeable in scripts like Makefiles and test suites, |
| 397 |
which often assume \f(CW\*(C`/\*(C'\fR as a path separator for subdirectories. |
| 398 |
.PP |
| 399 |
Also of use is \f(CW\*(C`File::Basename\*(C'\fR from the standard |
| 400 |
distribution, which splits a pathname into pieces (base filename, full |
| 401 |
path to directory, and file suffix). |
| 402 |
.PP |
| 403 |
Even when on a single platform (if you can call Unix a single platform), |
| 404 |
remember not to count on the existence or the contents of particular |
| 405 |
system-specific files or directories, like \fI/etc/passwd\fR, |
| 406 |
\&\fI/etc/sendmail.conf\fR, \fI/etc/resolv.conf\fR, or even \fI/tmp/\fR. For |
| 407 |
example, \fI/etc/passwd\fR may exist but not contain the encrypted |
| 408 |
passwords, because the system is using some form of enhanced security. |
| 409 |
Or it may not contain all the accounts, because the system is using NIS. |
| 410 |
If code does need to rely on such a file, include a description of the |
| 411 |
file and its format in the code's documentation, then make it easy for |
| 412 |
the user to override the default location of the file. |
| 413 |
.PP |
| 414 |
Don't assume a text file will end with a newline. They should, |
| 415 |
but people forget. |
| 416 |
.PP |
| 417 |
Do not have two files or directories of the same name with different |
| 418 |
case, like \fItest.pl\fR and \fITest.pl\fR, as many platforms have |
| 419 |
case-insensitive (or at least case-forgiving) filenames. Also, try |
| 420 |
not to have non-word characters (except for \f(CW\*(C`.\*(C'\fR) in the names, and |
| 421 |
keep them to the 8.3 convention, for maximum portability, onerous a |
| 422 |
burden though this may appear. |
| 423 |
.PP |
| 424 |
Likewise, when using the \f(CW\*(C`AutoSplit\*(C'\fR module, try to keep |
| 425 |
your functions to 8.3 naming and case-insensitive conventions; or, at the |
| 426 |
least, make it so the resulting files have a unique (case-insensitively) |
| 427 |
first 8 characters. |
| 428 |
.PP |
| 429 |
Whitespace in filenames is tolerated on most systems, but not all, |
| 430 |
and even on systems where it might be tolerated, some utilities |
| 431 |
might become confused by such whitespace. |
| 432 |
.PP |
| 433 |
Many systems (DOS, VMS ODS\-2) cannot have more than one \f(CW\*(C`.\*(C'\fR in their |
| 434 |
filenames. |
| 435 |
.PP |
| 436 |
Don't assume \f(CW\*(C`>\*(C'\fR won't be the first character of a filename. |
| 437 |
Always use the three-arg version of |
| 438 |
\&\f(CW\*(C`open\*(C'\fR: |
| 439 |
.PP |
| 440 |
.Vb 1 |
| 441 |
\& open my $fh, \*(Aq<\*(Aq, $existing_file) or die $!; |
| 442 |
.Ve |
| 443 |
.PP |
| 444 |
Two-arg \f(CW\*(C`open\*(C'\fR is magic and can |
| 445 |
translate characters like \f(CW\*(C`>\*(C'\fR, \f(CW\*(C`<\*(C'\fR, and \f(CW\*(C`|\*(C'\fR in filenames, |
| 446 |
which is usually the wrong thing to do. |
| 447 |
\&\f(CW\*(C`sysopen\*(C'\fR and three-arg |
| 448 |
\&\f(CW\*(C`open\*(C'\fR don't have this problem. |
| 449 |
.PP |
| 450 |
Don't use \f(CW\*(C`:\*(C'\fR as a part of a filename since many systems use that for |
| 451 |
their own semantics (Mac OS Classic for separating pathname components, |
| 452 |
many networking schemes and utilities for separating the nodename and |
| 453 |
the pathname, and so on). For the same reasons, avoid \f(CW\*(C`@\*(C'\fR, \f(CW\*(C`;\*(C'\fR and |
| 454 |
\&\f(CW\*(C`|\*(C'\fR. |
| 455 |
.PP |
| 456 |
Don't assume that in pathnames you can collapse two leading slashes |
| 457 |
\&\f(CW\*(C`//\*(C'\fR into one: some networking and clustering filesystems have special |
| 458 |
semantics for that. Let the operating system sort it out. |
| 459 |
.PP |
| 460 |
The \fIportable filename characters\fR as defined by ANSI C are |
| 461 |
.PP |
| 462 |
.Vb 4 |
| 463 |
\& a b c d e f g h i j k l m n o p q r s t u v w x y z |
| 464 |
\& A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
| 465 |
\& 0 1 2 3 4 5 6 7 8 9 |
| 466 |
\& . _ \- |
| 467 |
.Ve |
| 468 |
.PP |
| 469 |
and \f(CW\*(C`\-\*(C'\fR shouldn't be the first character. If you want to be |
| 470 |
hypercorrect, stay case-insensitive and within the 8.3 naming |
| 471 |
convention (all the files and directories have to be unique within one |
| 472 |
directory if their names are lowercased and truncated to eight |
| 473 |
characters before the \f(CW\*(C`.\*(C'\fR, if any, and to three characters after the |
| 474 |
\&\f(CW\*(C`.\*(C'\fR, if any). (And do not use \f(CW\*(C`.\*(C'\fRs in directory names.) |
| 475 |
.PP |
| 476 |
On Windows extra \f(CW\*(C`.\*(C'\fRs at the end of a file or directory name are |
| 477 |
ignored in most circumstances, and a directory name containing only |
| 478 |
three or more \f(CW\*(C`.\*(C'\fRs are treated as the current directory by some APIs. |
| 479 |
.SS "System Interaction" |
| 480 |
.IX Subsection "System Interaction" |
| 481 |
Not all platforms provide a command line. These are usually platforms |
| 482 |
that rely primarily on a Graphical User Interface (GUI) for user |
| 483 |
interaction. A program requiring a command line interface might |
| 484 |
not work everywhere. This is probably for the user of the program |
| 485 |
to deal with, so don't stay up late worrying about it. |
| 486 |
.PP |
| 487 |
Some platforms can't delete or rename files held open by the system, |
| 488 |
this limitation may also apply to changing filesystem metainformation |
| 489 |
like file permissions or owners. Remember to |
| 490 |
\&\f(CW\*(C`close\*(C'\fR files when you are done with them. |
| 491 |
Don't \f(CW\*(C`unlink\*(C'\fR or |
| 492 |
\&\f(CW\*(C`rename\*(C'\fR an open file. Don't |
| 493 |
\&\f(CW\*(C`tie\*(C'\fR or |
| 494 |
\&\f(CW\*(C`open\*(C'\fR a file already tied or opened; |
| 495 |
\&\f(CW\*(C`untie\*(C'\fR or |
| 496 |
\&\f(CW\*(C`close\*(C'\fR it first. |
| 497 |
.PP |
| 498 |
Don't open the same file more than once at a time for writing, as some |
| 499 |
operating systems put mandatory locks on such files. |
| 500 |
.PP |
| 501 |
Don't assume that write/modify permission on a directory gives the |
| 502 |
right to add or delete files/directories in that directory. That is |
| 503 |
filesystem specific: in some filesystems you need write/modify |
| 504 |
permission also (or even just) in the file/directory itself. In some |
| 505 |
filesystems (AFS, DFS) the permission to add/delete directory entries |
| 506 |
is a completely separate permission. |
| 507 |
.PP |
| 508 |
Don't assume that a single \f(CW\*(C`unlink\*(C'\fR completely |
| 509 |
gets rid of the file: some filesystems (most notably the ones in VMS) have |
| 510 |
versioned filesystems, and \f(CW\*(C`unlink\*(C'\fR removes only |
| 511 |
the most recent one (it doesn't remove all the versions because by default |
| 512 |
the native tools on those platforms remove just the most recent version, |
| 513 |
too). The portable idiom to remove all the versions of a file is |
| 514 |
.PP |
| 515 |
.Vb 1 |
| 516 |
\& 1 while unlink "file"; |
| 517 |
.Ve |
| 518 |
.PP |
| 519 |
This will terminate if the file is undeletable for some reason |
| 520 |
(protected, not there, and so on). |
| 521 |
.PP |
| 522 |
Don't count on a specific environment variable existing in |
| 523 |
\&\f(CW%ENV\fR. Don't count on \f(CW%ENV\fR entries |
| 524 |
being case-sensitive, or even case-preserving. Don't try to clear |
| 525 |
\&\f(CW%ENV\fR by saying \f(CW\*(C`%ENV = ();\*(C'\fR, or, if you really have |
| 526 |
to, make it conditional on \f(CW\*(C`$^O ne \*(AqVMS\*(Aq\*(C'\fR since in VMS the |
| 527 |
\&\f(CW%ENV\fR table is much more than a per-process key-value |
| 528 |
string table. |
| 529 |
.PP |
| 530 |
On VMS, some entries in the \f(CW%ENV\fR hash are dynamically |
| 531 |
created when their key is used on a read if they did not previously |
| 532 |
exist. The values for \f(CW$ENV{HOME}\fR, \f(CW$ENV{TERM}\fR, \f(CW$ENV{PATH}\fR, and |
| 533 |
\&\f(CW$ENV{USER}\fR, are known to be dynamically generated. The specific names |
| 534 |
that are dynamically generated may vary with the version of the C library |
| 535 |
on VMS, and more may exist than are documented. |
| 536 |
.PP |
| 537 |
On VMS by default, changes to the \f(CW%ENV\fR hash persist |
| 538 |
after perl exits. Subsequent invocations of perl in the same process can |
| 539 |
inadvertently inherit environment settings that were meant to be |
| 540 |
temporary. |
| 541 |
.PP |
| 542 |
Don't count on signals or \f(CW%SIG\fR for anything. |
| 543 |
.PP |
| 544 |
Don't count on filename globbing. Use |
| 545 |
\&\f(CW\*(C`opendir\*(C'\fR, |
| 546 |
\&\f(CW\*(C`readdir\*(C'\fR, and |
| 547 |
\&\f(CW\*(C`closedir\*(C'\fR instead. |
| 548 |
.PP |
| 549 |
Don't count on per-program environment variables, or per-program current |
| 550 |
directories. |
| 551 |
.PP |
| 552 |
Don't count on specific values of \f(CW$!\fR, neither numeric nor |
| 553 |
especially the string values. Users may switch their locales causing |
| 554 |
error messages to be translated into their languages. If you can |
| 555 |
trust a POSIXish environment, you can portably use the symbols defined |
| 556 |
by the \f(CW\*(C`Errno\*(C'\fR module, like \f(CW\*(C`ENOENT\*(C'\fR. And don't trust on the |
| 557 |
values of \f(CW$!\fR at all except immediately after a failed |
| 558 |
system call. |
| 559 |
.SS "Command names versus file pathnames" |
| 560 |
.IX Subsection "Command names versus file pathnames" |
| 561 |
Don't assume that the name used to invoke a command or program with |
| 562 |
\&\f(CW\*(C`system\*(C'\fR or \f(CW\*(C`exec\*(C'\fR can |
| 563 |
also be used to test for the existence of the file that holds the |
| 564 |
executable code for that command or program. |
| 565 |
First, many systems have "internal" commands that are built-in to the |
| 566 |
shell or OS and while these commands can be invoked, there is no |
| 567 |
corresponding file. Second, some operating systems (e.g., Cygwin, |
| 568 |
OS/2, and VOS) have required suffixes for executable files; |
| 569 |
these suffixes are generally permitted on the command name but are not |
| 570 |
required. Thus, a command like \f(CW\*(C`perl\*(C'\fR might exist in a file named |
| 571 |
\&\fIperl\fR, \fIperl.exe\fR, or \fIperl.pm\fR, depending on the operating system. |
| 572 |
The variable \f(CW$Config{_exe}\fR in the |
| 573 |
\&\f(CW\*(C`Config\*(C'\fR module holds the executable suffix, if any. Third, |
| 574 |
the VMS port carefully sets up \f(CW$^X\fR and |
| 575 |
\&\f(CW$Config{perlpath}\fR so that no further processing |
| 576 |
is required. This is just as well, because the matching regular |
| 577 |
expression used below would then have to deal with a possible trailing |
| 578 |
version number in the VMS file name. |
| 579 |
.PP |
| 580 |
To convert \f(CW$^X\fR to a file pathname, taking account of |
| 581 |
the requirements of the various operating system possibilities, say: |
| 582 |
.PP |
| 583 |
.Vb 6 |
| 584 |
\& use Config; |
| 585 |
\& my $thisperl = $^X; |
| 586 |
\& if ($^O ne \*(AqVMS\*(Aq) { |
| 587 |
\& $thisperl .= $Config{_exe} |
| 588 |
\& unless $thisperl =~ m/\eQ$Config{_exe}\eE$/i; |
| 589 |
\& } |
| 590 |
.Ve |
| 591 |
.PP |
| 592 |
To convert \f(CW$Config{perlpath}\fR to a file pathname, say: |
| 593 |
.PP |
| 594 |
.Vb 6 |
| 595 |
\& use Config; |
| 596 |
\& my $thisperl = $Config{perlpath}; |
| 597 |
\& if ($^O ne \*(AqVMS\*(Aq) { |
| 598 |
\& $thisperl .= $Config{_exe} |
| 599 |
\& unless $thisperl =~ m/\eQ$Config{_exe}\eE$/i; |
| 600 |
\& } |
| 601 |
.Ve |
| 602 |
.SS Networking |
| 603 |
.IX Subsection "Networking" |
| 604 |
Don't assume that you can reach the public Internet. |
| 605 |
.PP |
| 606 |
Don't assume that there is only one way to get through firewalls |
| 607 |
to the public Internet. |
| 608 |
.PP |
| 609 |
Don't assume that you can reach outside world through any other port |
| 610 |
than 80, or some web proxy. ftp is blocked by many firewalls. |
| 611 |
.PP |
| 612 |
Don't assume that you can send email by connecting to the local SMTP port. |
| 613 |
.PP |
| 614 |
Don't assume that you can reach yourself or any node by the name |
| 615 |
\&'localhost'. The same goes for '127.0.0.1'. You will have to try both. |
| 616 |
.PP |
| 617 |
Don't assume that the host has only one network card, or that it |
| 618 |
can't bind to many virtual IP addresses. |
| 619 |
.PP |
| 620 |
Don't assume a particular network device name. |
| 621 |
.PP |
| 622 |
Don't assume a particular set of |
| 623 |
\&\f(CW\*(C`ioctl\*(C'\fRs will work. |
| 624 |
.PP |
| 625 |
Don't assume that you can ping hosts and get replies. |
| 626 |
.PP |
| 627 |
Don't assume that any particular port (service) will respond. |
| 628 |
.PP |
| 629 |
Don't assume that \f(CW\*(C`Sys::Hostname\*(C'\fR (or any other API or |
| 630 |
command) returns either a fully qualified hostname or a non-qualified |
| 631 |
hostname: it all depends on how the system had been configured. Also |
| 632 |
remember that for things such as DHCP and NAT, the hostname you get back |
| 633 |
might not be very useful. |
| 634 |
.PP |
| 635 |
All the above \fIdon't\fRs may look daunting, and they are, but the key |
| 636 |
is to degrade gracefully if one cannot reach the particular network |
| 637 |
service one wants. Croaking or hanging do not look very professional. |
| 638 |
.SS "Interprocess Communication (IPC)" |
| 639 |
.IX Subsection "Interprocess Communication (IPC)" |
| 640 |
In general, don't directly access the system in code meant to be |
| 641 |
portable. That means, no \f(CW\*(C`system\*(C'\fR, |
| 642 |
\&\f(CW\*(C`exec\*(C'\fR, \f(CW\*(C`fork\*(C'\fR, |
| 643 |
\&\f(CW\*(C`pipe\*(C'\fR, |
| 644 |
\&\f(CW\`\`\fR or \f(CW\*(C`qx//\*(C'\fR, |
| 645 |
\&\f(CW\*(C`open\*(C'\fR with a \f(CW\*(C`|\*(C'\fR, nor any of the other |
| 646 |
things that makes being a Perl hacker worth being. |
| 647 |
.PP |
| 648 |
Commands that launch external processes are generally supported on |
| 649 |
most platforms (though many of them do not support any type of |
| 650 |
forking). The problem with using them arises from what you invoke |
| 651 |
them on. External tools are often named differently on different |
| 652 |
platforms, may not be available in the same location, might accept |
| 653 |
different arguments, can behave differently, and often present their |
| 654 |
results in a platform-dependent way. Thus, you should seldom depend |
| 655 |
on them to produce consistent results. (Then again, if you're calling |
| 656 |
\&\f(CW\*(C`netstat \-a\*(C'\fR, you probably don't expect it to run on both Unix and CP/M.) |
| 657 |
.PP |
| 658 |
One especially common bit of Perl code is opening a pipe to \fBsendmail\fR: |
| 659 |
.PP |
| 660 |
.Vb 2 |
| 661 |
\& open(my $mail, \*(Aq|\-\*(Aq, \*(Aq/usr/lib/sendmail \-t\*(Aq) |
| 662 |
\& or die "cannot fork sendmail: $!"; |
| 663 |
.Ve |
| 664 |
.PP |
| 665 |
This is fine for systems programming when sendmail is known to be |
| 666 |
available. But it is not fine for many non-Unix systems, and even |
| 667 |
some Unix systems that may not have sendmail installed. If a portable |
| 668 |
solution is needed, see the various distributions on CPAN that deal |
| 669 |
with it. \f(CW\*(C`Mail::Mailer\*(C'\fR and \f(CW\*(C`Mail::Send\*(C'\fR |
| 670 |
in the \f(CW\*(C`MailTools\*(C'\fR distribution are commonly used, and provide several |
| 671 |
mailing methods, including \f(CW\*(C`mail\*(C'\fR, \f(CW\*(C`sendmail\*(C'\fR, and direct SMTP (via |
| 672 |
\&\f(CW\*(C`Net::SMTP\*(C'\fR) if a mail transfer agent is not available. |
| 673 |
\&\f(CW\*(C`Mail::Sendmail\*(C'\fR is a standalone module that provides |
| 674 |
simple, platform-independent mailing. |
| 675 |
.PP |
| 676 |
The Unix System V IPC (\f(CW\*(C`msg*(), sem*(), shm*()\*(C'\fR) is not available |
| 677 |
even on all Unix platforms. |
| 678 |
.PP |
| 679 |
Do not use either the bare result of \f(CW\*(C`pack("N", 10, 20, 30, 40)\*(C'\fR or |
| 680 |
bare v\-strings (such as \f(CW\*(C`v10.20.30.40\*(C'\fR) to represent IPv4 addresses: |
| 681 |
both forms just pack the four bytes into network order. That this |
| 682 |
would be equal to the C language \f(CW\*(C`in_addr\*(C'\fR struct (which is what the |
| 683 |
socket code internally uses) is not guaranteed. To be portable use |
| 684 |
the routines of the \f(CW\*(C`Socket\*(C'\fR module, such as |
| 685 |
\&\f(CW\*(C`inet_aton\*(C'\fR, |
| 686 |
\&\f(CW\*(C`inet_ntoa\*(C'\fR, and |
| 687 |
\&\f(CW\*(C`sockaddr_in\*(C'\fR. |
| 688 |
.PP |
| 689 |
The rule of thumb for portable code is: Do it all in portable Perl, or |
| 690 |
use a module (that may internally implement it with platform-specific |
| 691 |
code, but exposes a common interface). |
| 692 |
.SS "External Subroutines (XS)" |
| 693 |
.IX Subsection "External Subroutines (XS)" |
| 694 |
XS code can usually be made to work with any platform, but dependent |
| 695 |
libraries, header files, etc., might not be readily available or |
| 696 |
portable, or the XS code itself might be platform-specific, just as Perl |
| 697 |
code might be. If the libraries and headers are portable, then it is |
| 698 |
normally reasonable to make sure the XS code is portable, too. |
| 699 |
.PP |
| 700 |
A different type of portability issue arises when writing XS code: |
| 701 |
availability of a C compiler on the end-user's system. C brings |
| 702 |
with it its own portability issues, and writing XS code will expose |
| 703 |
you to some of those. Writing purely in Perl is an easier way to |
| 704 |
achieve portability. |
| 705 |
.SS "Standard Modules" |
| 706 |
.IX Subsection "Standard Modules" |
| 707 |
In general, the standard modules work across platforms. Notable |
| 708 |
exceptions are the \f(CW\*(C`CPAN\*(C'\fR module (which currently makes |
| 709 |
connections to external programs that may not be available), |
| 710 |
platform-specific modules (like \f(CW\*(C`ExtUtils::MM_VMS\*(C'\fR), |
| 711 |
and DBM modules. |
| 712 |
.PP |
| 713 |
There is no one DBM module available on all platforms. |
| 714 |
\&\f(CW\*(C`SDBM_File\*(C'\fR and the others are generally available on all |
| 715 |
Unix and DOSish ports, but not in MacPerl, where only |
| 716 |
\&\f(CW\*(C`NDBM_File\*(C'\fR and \f(CW\*(C`DB_File\*(C'\fR are available. |
| 717 |
.PP |
| 718 |
The good news is that at least some DBM module should be available, and |
| 719 |
\&\f(CW\*(C`AnyDBM_File\*(C'\fR will use whichever module it can find. Of |
| 720 |
course, then the code needs to be fairly strict, dropping to the greatest |
| 721 |
common factor (e.g., not exceeding 1K for each record), so that it will |
| 722 |
work with any DBM module. See AnyDBM_File for more details. |
| 723 |
.SS "Time and Date" |
| 724 |
.IX Subsection "Time and Date" |
| 725 |
The system's notion of time of day and calendar date is controlled in |
| 726 |
widely different ways. Don't assume the timezone is stored in \f(CW$ENV{TZ}\fR, |
| 727 |
and even if it is, don't assume that you can control the timezone through |
| 728 |
that variable. Don't assume anything about the three-letter timezone |
| 729 |
abbreviations (for example that MST would be the Mountain Standard Time, |
| 730 |
it's been known to stand for Moscow Standard Time). If you need to |
| 731 |
use timezones, express them in some unambiguous format like the |
| 732 |
exact number of minutes offset from UTC, or the POSIX timezone |
| 733 |
format. |
| 734 |
.PP |
| 735 |
Don't assume that the epoch starts at 00:00:00, January 1, 1970, |
| 736 |
because that is OS\- and implementation-specific. It is better to |
| 737 |
store a date in an unambiguous representation. The ISO 8601 standard |
| 738 |
defines YYYY-MM-DD as the date format, or YYYY\-MM\-DDTHH:MM:SS |
| 739 |
(that's a literal "T" separating the date from the time). |
| 740 |
Please do use the ISO 8601 instead of making us guess what |
| 741 |
date 02/03/04 might be. ISO 8601 even sorts nicely as-is. |
| 742 |
A text representation (like "1987\-12\-18") can be easily converted |
| 743 |
into an OS-specific value using a module like |
| 744 |
\&\f(CW\*(C`Time::Piece\*(C'\fR (see "Date Parsing" in Time::Piece) or |
| 745 |
\&\f(CW\*(C`Date::Parse\*(C'\fR. An array of values, such as those |
| 746 |
returned by \f(CW\*(C`localtime\*(C'\fR, can be converted to an OS-specific |
| 747 |
representation using \f(CW\*(C`Time::Local\*(C'\fR. |
| 748 |
.PP |
| 749 |
When calculating specific times, such as for tests in time or date modules, |
| 750 |
it may be appropriate to calculate an offset for the epoch. |
| 751 |
.PP |
| 752 |
.Vb 2 |
| 753 |
\& use Time::Local qw(timegm); |
| 754 |
\& my $offset = timegm(0, 0, 0, 1, 0, 1970); |
| 755 |
.Ve |
| 756 |
.PP |
| 757 |
The value for \f(CW$offset\fR in Unix will be \f(CW0\fR, but in Mac OS Classic |
| 758 |
will be some large number. \f(CW$offset\fR can then be added to a Unix time |
| 759 |
value to get what should be the proper value on any system. |
| 760 |
.SS "Character sets and character encoding" |
| 761 |
.IX Subsection "Character sets and character encoding" |
| 762 |
Assume very little about character sets. |
| 763 |
.PP |
| 764 |
Assume nothing about numerical values (\f(CW\*(C`ord\*(C'\fR, |
| 765 |
\&\f(CW\*(C`chr\*(C'\fR) of characters. |
| 766 |
Do not use explicit code point ranges (like \f(CW\*(C`\exHH\-\exHH)\*(C'\fR. However, |
| 767 |
starting in Perl v5.22, regular expression pattern bracketed character |
| 768 |
class ranges specified like \f(CW\*(C`qr/[\eN{U+HH}\-\eN{U+HH}]/\*(C'\fR are portable, |
| 769 |
and starting in Perl v5.24, the same ranges are portable in |
| 770 |
\&\f(CW\*(C`tr///\*(C'\fR. |
| 771 |
You can portably use symbolic character classes like \f(CW\*(C`[:print:]\*(C'\fR. |
| 772 |
.PP |
| 773 |
Do not assume that the alphabetic characters are encoded contiguously |
| 774 |
(in the numeric sense). There may be gaps. Special coding in Perl, |
| 775 |
however, guarantees that all subsets of \f(CW\*(C`qr/[A\-Z]/\*(C'\fR, \f(CW\*(C`qr/[a\-z]/\*(C'\fR, and |
| 776 |
\&\f(CW\*(C`qr/[0\-9]/\*(C'\fR behave as expected. |
| 777 |
\&\f(CW\*(C`tr///\*(C'\fR |
| 778 |
behaves the same for these ranges. In patterns, any ranges specified with |
| 779 |
end points using the \f(CW\*(C`\eN{...}\*(C'\fR notations ensures character set |
| 780 |
portability, but it is a bug in Perl v5.22 that this isn't true of |
| 781 |
\&\f(CW\*(C`tr///\*(C'\fR, |
| 782 |
fixed in v5.24. |
| 783 |
.PP |
| 784 |
Do not assume anything about the ordering of the characters. |
| 785 |
The lowercase letters may come before or after the uppercase letters; |
| 786 |
the lowercase and uppercase may be interlaced so that both "a" and "A" |
| 787 |
come before "b"; the accented and other international characters may |
| 788 |
be interlaced so that ä comes before "b". |
| 789 |
Unicode::Collate can be used to sort this all out. |
| 790 |
.SS Internationalisation |
| 791 |
.IX Subsection "Internationalisation" |
| 792 |
If you may assume POSIX (a rather large assumption), you may read |
| 793 |
more about the POSIX locale system from perllocale. The locale |
| 794 |
system at least attempts to make things a little bit more portable, |
| 795 |
or at least more convenient and native-friendly for non-English |
| 796 |
users. The system affects character sets and encoding, and date |
| 797 |
and time formatting\-\-amongst other things. |
| 798 |
.PP |
| 799 |
If you really want to be international, you should consider Unicode. |
| 800 |
See perluniintro and perlunicode for more information. |
| 801 |
.PP |
| 802 |
By default Perl assumes your source code is written in an 8\-bit ASCII |
| 803 |
superset. To embed Unicode characters in your strings and regexes, you can |
| 804 |
use the \f(CW\*(C`\ex{HH}\*(C'\fR or (more portably) \f(CW\*(C`\eN{U+HH}\*(C'\fR |
| 805 |
notations. You can also use the |
| 806 |
\&\f(CW\*(C`utf8\*(C'\fR pragma and write your code in UTF\-8, which lets you use |
| 807 |
Unicode characters directly (not just in quoted constructs but also in |
| 808 |
identifiers). |
| 809 |
.SS "System Resources" |
| 810 |
.IX Subsection "System Resources" |
| 811 |
If your code is destined for systems with severely constrained (or |
| 812 |
missing!) virtual memory systems then you want to be \fIespecially\fR mindful |
| 813 |
of avoiding wasteful constructs such as: |
| 814 |
.PP |
| 815 |
.Vb 1 |
| 816 |
\& my @lines = <$very_large_file>; # bad |
| 817 |
\& |
| 818 |
\& while (<$fh>) {$file .= $_} # sometimes bad |
| 819 |
\& my $file = join(\*(Aq\*(Aq, <$fh>); # better |
| 820 |
.Ve |
| 821 |
.PP |
| 822 |
The last two constructs may appear unintuitive to most people. The |
| 823 |
first repeatedly grows a string, whereas the second allocates a |
| 824 |
large chunk of memory in one go. On some systems, the second is |
| 825 |
more efficient than the first. |
| 826 |
.SS Security |
| 827 |
.IX Subsection "Security" |
| 828 |
Most multi-user platforms provide basic levels of security, usually |
| 829 |
implemented at the filesystem level. Some, however, unfortunately do |
| 830 |
not. Thus the notion of user id, or "home" directory, |
| 831 |
or even the state of being logged-in, may be unrecognizable on many |
| 832 |
platforms. If you write programs that are security-conscious, it |
| 833 |
is usually best to know what type of system you will be running |
| 834 |
under so that you can write code explicitly for that platform (or |
| 835 |
class of platforms). |
| 836 |
.PP |
| 837 |
Don't assume the Unix filesystem access semantics: the operating |
| 838 |
system or the filesystem may be using some ACL systems, which are |
| 839 |
richer languages than the usual \f(CW\*(C`rwx\*(C'\fR. Even if the \f(CW\*(C`rwx\*(C'\fR exist, |
| 840 |
their semantics might be different. |
| 841 |
.PP |
| 842 |
(From the security viewpoint, testing for permissions before attempting to |
| 843 |
do something is silly anyway: if one tries this, there is potential |
| 844 |
for race conditions. Someone or something might change the |
| 845 |
permissions between the permissions check and the actual operation. |
| 846 |
Just try the operation.) |
| 847 |
.PP |
| 848 |
Don't assume the Unix user and group semantics: especially, don't |
| 849 |
expect \f(CW$<\fR and \f(CW$>\fR (or |
| 850 |
\&\f(CW$(\fR and \f(CW$)\fR) to work for switching |
| 851 |
identities (or memberships). |
| 852 |
.PP |
| 853 |
Don't assume set-uid and set-gid semantics. (And even if you do, |
| 854 |
think twice: set-uid and set-gid are a known can of security worms.) |
| 855 |
.SS Style |
| 856 |
.IX Subsection "Style" |
| 857 |
For those times when it is necessary to have platform-specific code, |
| 858 |
consider keeping the platform-specific code in one place, making porting |
| 859 |
to other platforms easier. Use the \f(CW\*(C`Config\*(C'\fR module and the |
| 860 |
special variable \f(CW$^O\fR to differentiate platforms, as |
| 861 |
described in "PLATFORMS". |
| 862 |
.PP |
| 863 |
Beware of the "else syndrome": |
| 864 |
.PP |
| 865 |
.Vb 5 |
| 866 |
\& if ($^O eq \*(AqMSWin32\*(Aq) { |
| 867 |
\& # code that assumes Windows |
| 868 |
\& } else { |
| 869 |
\& # code that assumes Linux |
| 870 |
\& } |
| 871 |
.Ve |
| 872 |
.PP |
| 873 |
The \f(CW\*(C`else\*(C'\fR branch should be used for the really ultimate fallback, |
| 874 |
not for code specific to some platform. |
| 875 |
.PP |
| 876 |
Be careful in the tests you supply with your module or programs. |
| 877 |
Module code may be fully portable, but its tests might not be. This |
| 878 |
often happens when tests spawn off other processes or call external |
| 879 |
programs to aid in the testing, or when (as noted above) the tests |
| 880 |
assume certain things about the filesystem and paths. Be careful not |
| 881 |
to depend on a specific output style for errors, such as when checking |
| 882 |
\&\f(CW$!\fR after a failed system call. Using |
| 883 |
\&\f(CW$!\fR for anything else than displaying it as output is |
| 884 |
doubtful (though see the \f(CW\*(C`Errno\*(C'\fR module for testing reasonably |
| 885 |
portably for error value). Some platforms expect a certain output format, |
| 886 |
and Perl on those platforms may have been adjusted accordingly. Most |
| 887 |
specifically, don't anchor a regex when testing an error value. |
| 888 |
.SH "CPAN Testers" |
| 889 |
.IX Header "CPAN Testers" |
| 890 |
Modules uploaded to CPAN are tested by a variety of volunteers on |
| 891 |
different platforms. These CPAN testers are notified by mail of each |
| 892 |
new upload, and reply to the list with PASS, FAIL, NA (not applicable to |
| 893 |
this platform), or UNKNOWN (unknown), along with any relevant notations. |
| 894 |
.PP |
| 895 |
The purpose of the testing is twofold: one, to help developers fix any |
| 896 |
problems in their code that crop up because of lack of testing on other |
| 897 |
platforms; two, to provide users with information about whether |
| 898 |
a given module works on a given platform. |
| 899 |
.PP |
| 900 |
Also see: |
| 901 |
.IP \(bu 4 |
| 902 |
Mailing list: cpan\-testers\[email protected] |
| 903 |
.IP \(bu 4 |
| 904 |
Testing results: <https://www.cpantesters.org/> |
| 905 |
.SH PLATFORMS |
| 906 |
.IX Header "PLATFORMS" |
| 907 |
Perl is built with a \f(CW$^O\fR variable that indicates the |
| 908 |
operating system it was built on. This was implemented |
| 909 |
to help speed up code that would otherwise have to \f(CW\*(C`use Config\*(C'\fR |
| 910 |
and use the value of \f(CW$Config{osname}\fR. Of course, |
| 911 |
to get more detailed information about the system, looking into |
| 912 |
\&\f(CW%Config\fR is certainly recommended. |
| 913 |
.PP |
| 914 |
\&\f(CW%Config\fR cannot always be trusted, however, |
| 915 |
because it was built at compile time. If perl was built in one place, |
| 916 |
then transferred elsewhere, some values may be wrong. The values may |
| 917 |
even have been edited after the fact. |
| 918 |
.SS Unix |
| 919 |
.IX Subsection "Unix" |
| 920 |
Perl works on a bewildering variety of Unix and Unix-like platforms (see |
| 921 |
e.g. most of the files in the \fIhints/\fR directory in the source code kit). |
| 922 |
On most of these systems, the value of \f(CW$^O\fR (hence |
| 923 |
\&\f(CW$Config{osname}\fR, too) is determined either by |
| 924 |
lowercasing and stripping punctuation from the first field of the string |
| 925 |
returned by typing \f(CW\*(C`uname \-a\*(C'\fR (or a similar command) at the shell prompt |
| 926 |
or by testing the file system for the presence of uniquely named files |
| 927 |
such as a kernel or header file. Here, for example, are a few of the |
| 928 |
more popular Unix flavors: |
| 929 |
.PP |
| 930 |
.Vb 10 |
| 931 |
\& uname $^O $Config{archname} |
| 932 |
\& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- |
| 933 |
\& AIX aix aix |
| 934 |
\& BSD/OS bsdos i386\-bsdos |
| 935 |
\& Darwin darwin darwin |
| 936 |
\& DYNIX/ptx dynixptx i386\-dynixptx |
| 937 |
\& FreeBSD freebsd freebsd\-i386 |
| 938 |
\& Haiku haiku BePC\-haiku |
| 939 |
\& Linux linux arm\-linux |
| 940 |
\& Linux linux armv5tel\-linux |
| 941 |
\& Linux linux i386\-linux |
| 942 |
\& Linux linux i586\-linux |
| 943 |
\& Linux linux ppc\-linux |
| 944 |
\& HP\-UX hpux PA\-RISC1.1 |
| 945 |
\& IRIX irix irix |
| 946 |
\& Mac OS X darwin darwin |
| 947 |
\& NeXT 3 next next\-fat |
| 948 |
\& NeXT 4 next OPENSTEP\-Mach |
| 949 |
\& openbsd openbsd i386\-openbsd |
| 950 |
\& OSF1 dec_osf alpha\-dec_osf |
| 951 |
\& reliantunix\-n svr4 RM400\-svr4 |
| 952 |
\& SCO_SV sco_sv i386\-sco_sv |
| 953 |
\& SINIX\-N svr4 RM400\-svr4 |
| 954 |
\& sn4609 unicos CRAY_C90\-unicos |
| 955 |
\& sn6521 unicosmk t3e\-unicosmk |
| 956 |
\& sn9617 unicos CRAY_J90\-unicos |
| 957 |
\& SunOS solaris sun4\-solaris |
| 958 |
\& SunOS solaris i86pc\-solaris |
| 959 |
\& SunOS4 sunos sun4\-sunos |
| 960 |
.Ve |
| 961 |
.PP |
| 962 |
Because the value of \f(CW$Config{archname}\fR may |
| 963 |
depend on the hardware architecture, it can vary more than the value of |
| 964 |
\&\f(CW$^O\fR. |
| 965 |
.SS "DOS and Derivatives" |
| 966 |
.IX Subsection "DOS and Derivatives" |
| 967 |
Perl has long been ported to Intel-style microcomputers running under |
| 968 |
systems like PC-DOS, MS-DOS, OS/2, and most Windows platforms you can |
| 969 |
bring yourself to mention (except for Windows CE, if you count that). |
| 970 |
Users familiar with \fICOMMAND.COM\fR or \fICMD.EXE\fR style shells should |
| 971 |
be aware that each of these file specifications may have subtle |
| 972 |
differences: |
| 973 |
.PP |
| 974 |
.Vb 4 |
| 975 |
\& my $filespec0 = "c:/foo/bar/file.txt"; |
| 976 |
\& my $filespec1 = "c:\e\efoo\e\ebar\e\efile.txt"; |
| 977 |
\& my $filespec2 = \*(Aqc:\efoo\ebar\efile.txt\*(Aq; |
| 978 |
\& my $filespec3 = \*(Aqc:\e\efoo\e\ebar\e\efile.txt\*(Aq; |
| 979 |
.Ve |
| 980 |
.PP |
| 981 |
System calls accept either \f(CW\*(C`/\*(C'\fR or \f(CW\*(C`\e\*(C'\fR as the path separator. |
| 982 |
However, many command-line utilities of DOS vintage treat \f(CW\*(C`/\*(C'\fR as |
| 983 |
the option prefix, so may get confused by filenames containing \f(CW\*(C`/\*(C'\fR. |
| 984 |
Aside from calling any external programs, \f(CW\*(C`/\*(C'\fR will work just fine, |
| 985 |
and probably better, as it is more consistent with popular usage, |
| 986 |
and avoids the problem of remembering what to backwhack and what |
| 987 |
not to. |
| 988 |
.PP |
| 989 |
The DOS FAT filesystem can accommodate only "8.3" style filenames. Under |
| 990 |
the "case-insensitive, but case-preserving" HPFS (OS/2) and NTFS (NT) |
| 991 |
filesystems you may have to be careful about case returned with functions |
| 992 |
like \f(CW\*(C`readdir\*(C'\fR or used with functions like |
| 993 |
\&\f(CW\*(C`open\*(C'\fR or |
| 994 |
\&\f(CW\*(C`opendir\*(C'\fR. |
| 995 |
.PP |
| 996 |
DOS also treats several filenames as special, such as \fIAUX\fR, \fIPRN\fR, |
| 997 |
\&\fINUL\fR, \fICON\fR, \fICOM1\fR, \fILPT1\fR, \fILPT2\fR, etc. Unfortunately, sometimes |
| 998 |
these filenames won't even work if you include an explicit directory |
| 999 |
prefix. It is best to avoid such filenames, if you want your code to be |
| 1000 |
portable to DOS and its derivatives. It's hard to know what these all |
| 1001 |
are, unfortunately. |
| 1002 |
.PP |
| 1003 |
Users of these operating systems may also wish to make use of |
| 1004 |
scripts such as \fIpl2bat.bat\fR to put wrappers around your scripts. |
| 1005 |
.PP |
| 1006 |
Newline (\f(CW\*(C`\en\*(C'\fR) is translated as \f(CW\*(C`\e015\e012\*(C'\fR by the I/O system when |
| 1007 |
reading from and writing to files (see "Newlines"). |
| 1008 |
\&\f(CWbinmode($filehandle)\fR will keep \f(CW\*(C`\en\*(C'\fR translated as \f(CW\*(C`\e012\*(C'\fR for that |
| 1009 |
filehandle. |
| 1010 |
\&\f(CW\*(C`binmode\*(C'\fR should always be used for code |
| 1011 |
that deals with binary data. That's assuming you realize in advance that |
| 1012 |
your data is in binary. General-purpose programs should often assume |
| 1013 |
nothing about their data. |
| 1014 |
.PP |
| 1015 |
The \f(CW$^O\fR variable and the |
| 1016 |
\&\f(CW$Config{archname}\fR values for various DOSish |
| 1017 |
perls are as follows: |
| 1018 |
.PP |
| 1019 |
.Vb 10 |
| 1020 |
\& OS $^O $Config{archname} ID Version |
| 1021 |
\& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- |
| 1022 |
\& MS\-DOS dos ? |
| 1023 |
\& PC\-DOS dos ? |
| 1024 |
\& OS/2 os2 ? |
| 1025 |
\& Windows 3.1 ? ? 0 3 01 |
| 1026 |
\& Windows 95 MSWin32 MSWin32\-x86 1 4 00 |
| 1027 |
\& Windows 98 MSWin32 MSWin32\-x86 1 4 10 |
| 1028 |
\& Windows ME MSWin32 MSWin32\-x86 1 ? |
| 1029 |
\& Windows NT MSWin32 MSWin32\-x86 2 4 xx |
| 1030 |
\& Windows NT MSWin32 MSWin32\-ALPHA 2 4 xx |
| 1031 |
\& Windows NT MSWin32 MSWin32\-ppc 2 4 xx |
| 1032 |
\& Windows 2000 MSWin32 MSWin32\-x86 2 5 00 |
| 1033 |
\& Windows XP MSWin32 MSWin32\-x86 2 5 01 |
| 1034 |
\& Windows 2003 MSWin32 MSWin32\-x86 2 5 02 |
| 1035 |
\& Windows Vista MSWin32 MSWin32\-x86 2 6 00 |
| 1036 |
\& Windows 7 MSWin32 MSWin32\-x86 2 6 01 |
| 1037 |
\& Windows 7 MSWin32 MSWin32\-x64 2 6 01 |
| 1038 |
\& Windows 2008 MSWin32 MSWin32\-x86 2 6 01 |
| 1039 |
\& Windows 2008 MSWin32 MSWin32\-x64 2 6 01 |
| 1040 |
\& Windows CE MSWin32 ? 3 |
| 1041 |
\& Cygwin cygwin cygwin |
| 1042 |
.Ve |
| 1043 |
.PP |
| 1044 |
The various MSWin32 Perl's can distinguish the OS they are running on |
| 1045 |
via the value of the fifth element of the list returned from |
| 1046 |
\&\f(CWWin32::GetOSVersion()\fR. For example: |
| 1047 |
.PP |
| 1048 |
.Vb 4 |
| 1049 |
\& if ($^O eq \*(AqMSWin32\*(Aq) { |
| 1050 |
\& my @os_version_info = Win32::GetOSVersion(); |
| 1051 |
\& print +(\*(Aq3.1\*(Aq,\*(Aq95\*(Aq,\*(AqNT\*(Aq)[$os_version_info[4]],"\en"; |
| 1052 |
\& } |
| 1053 |
.Ve |
| 1054 |
.PP |
| 1055 |
There are also \f(CW\*(C`Win32::IsWinNT()|Win32/Win32::IsWinNT()\*(C'\fR, |
| 1056 |
\&\f(CW\*(C`Win32::IsWin95()|Win32/Win32::IsWin95()\*(C'\fR, and |
| 1057 |
\&\f(CWWin32::GetOSName()\fR; try |
| 1058 |
\&\f(CW\*(C`perldoc Win32\*(C'\fR. |
| 1059 |
The very portable \f(CWPOSIX::uname()\fR will work too: |
| 1060 |
.PP |
| 1061 |
.Vb 2 |
| 1062 |
\& c:\e> perl \-MPOSIX \-we "print join \*(Aq|\*(Aq, uname" |
| 1063 |
\& Windows NT|moonru|5.0|Build 2195 (Service Pack 2)|x86 |
| 1064 |
.Ve |
| 1065 |
.PP |
| 1066 |
Errors set by Winsock functions are now put directly into \f(CW$^E\fR, |
| 1067 |
and the relevant \f(CW\*(C`WSAE*\*(C'\fR error codes are now exported from the |
| 1068 |
Errno and POSIX modules for testing this against. |
| 1069 |
.PP |
| 1070 |
The previous behavior of putting the errors (converted to POSIX-style |
| 1071 |
\&\f(CW\*(C`E*\*(C'\fR error codes since Perl 5.20.0) into \f(CW$!\fR was buggy due to |
| 1072 |
the non-equivalence of like-named Winsock and POSIX error constants, |
| 1073 |
a relationship between which has unfortunately been established |
| 1074 |
in one way or another since Perl 5.8.0. |
| 1075 |
.PP |
| 1076 |
The new behavior provides a much more robust solution for checking |
| 1077 |
Winsock errors in portable software without accidentally matching |
| 1078 |
POSIX tests that were intended for other OSes and may have different |
| 1079 |
meanings for Winsock. |
| 1080 |
.PP |
| 1081 |
The old behavior is currently retained, warts and all, for backwards |
| 1082 |
compatibility, but users are encouraged to change any code that |
| 1083 |
tests \f(CW$!\fR against \f(CW\*(C`E*\*(C'\fR constants for Winsock errors to instead |
| 1084 |
test \f(CW$^E\fR against \f(CW\*(C`WSAE*\*(C'\fR constants. After a suitable deprecation |
| 1085 |
period, which started with Perl 5.24, the old behavior may be |
| 1086 |
removed, leaving \f(CW$!\fR unchanged after Winsock function calls, to |
| 1087 |
avoid any possible confusion over which error variable to check. |
| 1088 |
.PP |
| 1089 |
Also see: |
| 1090 |
.IP \(bu 4 |
| 1091 |
The EMX environment for DOS, OS/2, etc. [email protected], |
| 1092 |
<ftp://hobbes.nmsu.edu/pub/os2/dev/emx/> Also perlos2. |
| 1093 |
.IP \(bu 4 |
| 1094 |
Build instructions for Win32 in perlwin32, or under the Cygnus environment |
| 1095 |
in perlcygwin. |
| 1096 |
.IP \(bu 4 |
| 1097 |
The \f(CW\*(C`Win32::*\*(C'\fR modules in Win32. |
| 1098 |
.IP \(bu 4 |
| 1099 |
The ActiveState Pages, <https://www.activestate.com/> |
| 1100 |
.IP \(bu 4 |
| 1101 |
The Cygwin environment for Win32; \fIREADME.cygwin\fR (installed |
| 1102 |
as perlcygwin), <https://www.cygwin.com/> |
| 1103 |
.IP \(bu 4 |
| 1104 |
Build instructions for OS/2, perlos2 |
| 1105 |
.SS VMS |
| 1106 |
.IX Subsection "VMS" |
| 1107 |
Perl on VMS is discussed in perlvms in the Perl distribution. |
| 1108 |
.PP |
| 1109 |
The official name of VMS as of this writing is OpenVMS. |
| 1110 |
.PP |
| 1111 |
Interacting with Perl from the Digital Command Language (DCL) shell |
| 1112 |
often requires a different set of quotation marks than Unix shells do. |
| 1113 |
For example: |
| 1114 |
.PP |
| 1115 |
.Vb 2 |
| 1116 |
\& $ perl \-e "print ""Hello, world.\en""" |
| 1117 |
\& Hello, world. |
| 1118 |
.Ve |
| 1119 |
.PP |
| 1120 |
There are several ways to wrap your Perl scripts in DCL \fI.COM\fR files, if |
| 1121 |
you are so inclined. For example: |
| 1122 |
.PP |
| 1123 |
.Vb 6 |
| 1124 |
\& $ write sys$output "Hello from DCL!" |
| 1125 |
\& $ if p1 .eqs. "" |
| 1126 |
\& $ then perl \-x \*(Aqf$environment("PROCEDURE") |
| 1127 |
\& $ else perl \-x \- \*(Aqp1 \*(Aqp2 \*(Aqp3 \*(Aqp4 \*(Aqp5 \*(Aqp6 \*(Aqp7 \*(Aqp8 |
| 1128 |
\& $ deck/dollars="_\|_END_\|_" |
| 1129 |
\& #!/usr/bin/perl |
| 1130 |
\& |
| 1131 |
\& print "Hello from Perl!\en"; |
| 1132 |
\& |
| 1133 |
\& _\|_END_\|_ |
| 1134 |
\& $ endif |
| 1135 |
.Ve |
| 1136 |
.PP |
| 1137 |
Do take care with \f(CW\*(C`$ ASSIGN/nolog/user SYS$COMMAND: SYS$INPUT\*(C'\fR if your |
| 1138 |
Perl-in-DCL script expects to do things like \f(CW\*(C`$read = <STDIN>;\*(C'\fR. |
| 1139 |
.PP |
| 1140 |
The VMS operating system has two filesystems, designated by their |
| 1141 |
on-disk structure (ODS) level: ODS\-2 and its successor ODS\-5. The |
| 1142 |
initial port of Perl to VMS pre-dates ODS\-5, but all current testing and |
| 1143 |
development assumes ODS\-5 and its capabilities, including case |
| 1144 |
preservation, extended characters in filespecs, and names up to 8192 |
| 1145 |
bytes long. |
| 1146 |
.PP |
| 1147 |
Perl on VMS can accept either VMS\- or Unix-style file |
| 1148 |
specifications as in either of the following: |
| 1149 |
.PP |
| 1150 |
.Vb 2 |
| 1151 |
\& $ perl \-ne "print if /perl_setup/i" SYS$LOGIN:LOGIN.COM |
| 1152 |
\& $ perl \-ne "print if /perl_setup/i" /sys$login/login.com |
| 1153 |
.Ve |
| 1154 |
.PP |
| 1155 |
but not a mixture of both as in: |
| 1156 |
.PP |
| 1157 |
.Vb 2 |
| 1158 |
\& $ perl \-ne "print if /perl_setup/i" sys$login:/login.com |
| 1159 |
\& Can\*(Aqt open sys$login:/login.com: file specification syntax error |
| 1160 |
.Ve |
| 1161 |
.PP |
| 1162 |
In general, the easiest path to portability is always to specify |
| 1163 |
filenames in Unix format unless they will need to be processed by native |
| 1164 |
commands or utilities. Because of this latter consideration, the |
| 1165 |
File::Spec module by default returns native format specifications |
| 1166 |
regardless of input format. This default may be reversed so that |
| 1167 |
filenames are always reported in Unix format by specifying the |
| 1168 |
\&\f(CW\*(C`DECC$FILENAME_UNIX_REPORT\*(C'\fR feature logical in the environment. |
| 1169 |
.PP |
| 1170 |
The file type, or extension, is always present in a VMS-format file |
| 1171 |
specification even if it's zero-length. This means that, by default, |
| 1172 |
\&\f(CW\*(C`readdir\*(C'\fR will return a trailing dot on a |
| 1173 |
file with no extension, so where you would see \f(CW"a"\fR on Unix you'll see |
| 1174 |
\&\f(CW"a."\fR on VMS. However, the trailing dot may be suppressed by enabling |
| 1175 |
the \f(CW\*(C`DECC$READDIR_DROPDOTNOTYPE\*(C'\fR feature in the environment (see the CRTL |
| 1176 |
documentation on feature logical names). |
| 1177 |
.PP |
| 1178 |
What \f(CW\*(C`\en\*(C'\fR represents depends on the type of file opened. It usually |
| 1179 |
represents \f(CW\*(C`\e012\*(C'\fR but it could also be \f(CW\*(C`\e015\*(C'\fR, \f(CW\*(C`\e012\*(C'\fR, \f(CW\*(C`\e015\e012\*(C'\fR, |
| 1180 |
\&\f(CW\*(C`\e000\*(C'\fR, \f(CW\*(C`\e040\*(C'\fR, or nothing depending on the file organization and |
| 1181 |
record format. The \f(CW\*(C`VMS::Stdio\*(C'\fR module provides access to |
| 1182 |
the special \f(CWfopen()\fR requirements of files with unusual attributes on |
| 1183 |
VMS. |
| 1184 |
.PP |
| 1185 |
The value of \f(CW$^O\fR on OpenVMS is "VMS". To determine the |
| 1186 |
architecture that you are running on refer to |
| 1187 |
\&\f(CW$Config{archname}\fR. |
| 1188 |
.PP |
| 1189 |
On VMS, perl determines the UTC offset from the \f(CW\*(C`SYS$TIMEZONE_DIFFERENTIAL\*(C'\fR |
| 1190 |
logical name. Although the VMS epoch began at 17\-NOV\-1858 00:00:00.00, |
| 1191 |
calls to \f(CW\*(C`localtime\*(C'\fR are adjusted to count |
| 1192 |
offsets from 01\-JAN\-1970 00:00:00.00, just like Unix. |
| 1193 |
.PP |
| 1194 |
Also see: |
| 1195 |
.IP \(bu 4 |
| 1196 |
\&\fIREADME.vms\fR (installed as \fIREADME_vms\fR), perlvms |
| 1197 |
.IP \(bu 4 |
| 1198 |
vmsperl list, vmsperl\[email protected] |
| 1199 |
.IP \(bu 4 |
| 1200 |
vmsperl on the web, <http://www.sidhe.org/vmsperl/index.html> |
| 1201 |
.IP \(bu 4 |
| 1202 |
VMS Software Inc. web site, <http://www.vmssoftware.com> |
| 1203 |
.SS VOS |
| 1204 |
.IX Subsection "VOS" |
| 1205 |
Perl on VOS (also known as OpenVOS) is discussed in \fIREADME.vos\fR |
| 1206 |
in the Perl distribution (installed as perlvos). Perl on VOS |
| 1207 |
can accept either VOS\- or Unix-style file specifications as in |
| 1208 |
either of the following: |
| 1209 |
.PP |
| 1210 |
.Vb 2 |
| 1211 |
\& $ perl \-ne "print if /perl_setup/i" >system>notices |
| 1212 |
\& $ perl \-ne "print if /perl_setup/i" /system/notices |
| 1213 |
.Ve |
| 1214 |
.PP |
| 1215 |
or even a mixture of both as in: |
| 1216 |
.PP |
| 1217 |
.Vb 1 |
| 1218 |
\& $ perl \-ne "print if /perl_setup/i" >system/notices |
| 1219 |
.Ve |
| 1220 |
.PP |
| 1221 |
Even though VOS allows the slash character to appear in object |
| 1222 |
names, because the VOS port of Perl interprets it as a pathname |
| 1223 |
delimiting character, VOS files, directories, or links whose |
| 1224 |
names contain a slash character cannot be processed. Such files |
| 1225 |
must be renamed before they can be processed by Perl. |
| 1226 |
.PP |
| 1227 |
Older releases of VOS (prior to OpenVOS Release 17.0) limit file |
| 1228 |
names to 32 or fewer characters, prohibit file names from |
| 1229 |
starting with a \f(CW\*(C`\-\*(C'\fR character, and prohibit file names from |
| 1230 |
containing \f(CW\*(C` \*(C'\fR (space) or any character from the set \f(CW\*(C`!#%&\*(Aq()*;<=>?\*(C'\fR. |
| 1231 |
.PP |
| 1232 |
Newer releases of VOS (OpenVOS Release 17.0 or later) support a |
| 1233 |
feature known as extended names. On these releases, file names |
| 1234 |
can contain up to 255 characters, are prohibited from starting |
| 1235 |
with a \f(CW\*(C`\-\*(C'\fR character, and the set of prohibited characters is |
| 1236 |
reduced to \f(CW\*(C`#%*<>?\*(C'\fR. There are |
| 1237 |
restrictions involving spaces and apostrophes: these characters |
| 1238 |
must not begin or end a name, nor can they immediately precede or |
| 1239 |
follow a period. Additionally, a space must not immediately |
| 1240 |
precede another space or hyphen. Specifically, the following |
| 1241 |
character combinations are prohibited: space-space, |
| 1242 |
space-hyphen, period-space, space-period, period-apostrophe, |
| 1243 |
apostrophe-period, leading or trailing space, and leading or |
| 1244 |
trailing apostrophe. Although an extended file name is limited |
| 1245 |
to 255 characters, a path name is still limited to 256 |
| 1246 |
characters. |
| 1247 |
.PP |
| 1248 |
The value of \f(CW$^O\fR on VOS is "vos". To determine the |
| 1249 |
architecture that you are running on refer to |
| 1250 |
\&\f(CW$Config{archname}\fR. |
| 1251 |
.PP |
| 1252 |
Also see: |
| 1253 |
.IP \(bu 4 |
| 1254 |
\&\fIREADME.vos\fR (installed as perlvos) |
| 1255 |
.IP \(bu 4 |
| 1256 |
The VOS mailing list. |
| 1257 |
.Sp |
| 1258 |
There is no specific mailing list for Perl on VOS. You can contact |
| 1259 |
the Stratus Technologies Customer Assistance Center (CAC) for your |
| 1260 |
region, or you can use the contact information located in the |
| 1261 |
distribution files on the Stratus Anonymous FTP site. |
| 1262 |
.IP \(bu 4 |
| 1263 |
Stratus Technologies on the web at <http://www.stratus.com> |
| 1264 |
.IP \(bu 4 |
| 1265 |
VOS Open-Source Software on the web at <http://ftp.stratus.com/pub/vos/vos.html> |
| 1266 |
.SS "EBCDIC Platforms" |
| 1267 |
.IX Subsection "EBCDIC Platforms" |
| 1268 |
v5.22 core Perl runs on z/OS (formerly OS/390). Theoretically it could |
| 1269 |
run on the successors of OS/400 on AS/400 minicomputers as well as |
| 1270 |
VM/ESA, and BS2000 for S/390 Mainframes. Such computers use EBCDIC |
| 1271 |
character sets internally (usually Character Code Set ID 0037 for OS/400 |
| 1272 |
and either 1047 or POSIX-BC for S/390 systems). |
| 1273 |
.PP |
| 1274 |
The rest of this section may need updating, but we don't know what it |
| 1275 |
should say. Please submit comments to |
| 1276 |
<https://github.com/Perl/perl5/issues>. |
| 1277 |
.PP |
| 1278 |
On the mainframe Perl currently works under the "Unix system |
| 1279 |
services for OS/390" (formerly known as OpenEdition), VM/ESA OpenEdition, or |
| 1280 |
the BS200 POSIX-BC system (BS2000 is supported in Perl 5.6 and greater). |
| 1281 |
See perlos390 for details. Note that for OS/400 there is also a port of |
| 1282 |
Perl 5.8.1/5.10.0 or later to the PASE which is ASCII-based (as opposed to |
| 1283 |
ILE which is EBCDIC-based), see perlos400. |
| 1284 |
.PP |
| 1285 |
As of R2.5 of USS for OS/390 and Version 2.3 of VM/ESA these Unix |
| 1286 |
sub-systems do not support the \f(CW\*(C`#!\*(C'\fR shebang trick for script invocation. |
| 1287 |
Hence, on OS/390 and VM/ESA Perl scripts can be executed with a header |
| 1288 |
similar to the following simple script: |
| 1289 |
.PP |
| 1290 |
.Vb 4 |
| 1291 |
\& : # use perl |
| 1292 |
\& eval \*(Aqexec /usr/local/bin/perl \-S $0 ${1+"$@"}\*(Aq |
| 1293 |
\& if 0; |
| 1294 |
\& #!/usr/local/bin/perl # just a comment really |
| 1295 |
\& |
| 1296 |
\& print "Hello from perl!\en"; |
| 1297 |
.Ve |
| 1298 |
.PP |
| 1299 |
OS/390 will support the \f(CW\*(C`#!\*(C'\fR shebang trick in release 2.8 and beyond. |
| 1300 |
Calls to \f(CW\*(C`system\*(C'\fR and backticks can use POSIX |
| 1301 |
shell syntax on all S/390 systems. |
| 1302 |
.PP |
| 1303 |
On the AS/400, if PERL5 is in your library list, you may need |
| 1304 |
to wrap your Perl scripts in a CL procedure to invoke them like so: |
| 1305 |
.PP |
| 1306 |
.Vb 3 |
| 1307 |
\& BEGIN |
| 1308 |
\& CALL PGM(PERL5/PERL) PARM(\*(Aq/QOpenSys/hello.pl\*(Aq) |
| 1309 |
\& ENDPGM |
| 1310 |
.Ve |
| 1311 |
.PP |
| 1312 |
This will invoke the Perl script \fIhello.pl\fR in the root of the |
| 1313 |
QOpenSys file system. On the AS/400 calls to |
| 1314 |
\&\f(CW\*(C`system\*(C'\fR or backticks must use CL syntax. |
| 1315 |
.PP |
| 1316 |
On these platforms, bear in mind that the EBCDIC character set may have |
| 1317 |
an effect on what happens with some Perl functions (such as |
| 1318 |
\&\f(CW\*(C`chr\*(C'\fR, \f(CW\*(C`pack\*(C'\fR, |
| 1319 |
\&\f(CW\*(C`print\*(C'\fR, |
| 1320 |
\&\f(CW\*(C`printf\*(C'\fR, |
| 1321 |
\&\f(CW\*(C`ord\*(C'\fR, \f(CW\*(C`sort\*(C'\fR, |
| 1322 |
\&\f(CW\*(C`sprintf\*(C'\fR, |
| 1323 |
\&\f(CW\*(C`unpack\*(C'\fR), as |
| 1324 |
well as bit-fiddling with ASCII constants using operators like |
| 1325 |
\&\f(CW\*(C`^\*(C'\fR, \f(CW\*(C`&\*(C'\fR and \f(CW\*(C`|\*(C'\fR, not to mention |
| 1326 |
dealing with socket interfaces to ASCII computers (see "Newlines"). |
| 1327 |
.PP |
| 1328 |
Fortunately, most web servers for the mainframe will correctly |
| 1329 |
translate the \f(CW\*(C`\en\*(C'\fR in the following statement to its ASCII equivalent |
| 1330 |
(\f(CW\*(C`\er\*(C'\fR is the same under both Unix and z/OS): |
| 1331 |
.PP |
| 1332 |
.Vb 1 |
| 1333 |
\& print "Content\-type: text/html\er\en\er\en"; |
| 1334 |
.Ve |
| 1335 |
.PP |
| 1336 |
The values of \f(CW$^O\fR on some of these platforms include: |
| 1337 |
.PP |
| 1338 |
.Vb 5 |
| 1339 |
\& uname $^O $Config{archname} |
| 1340 |
\& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- |
| 1341 |
\& OS/390 os390 os390 |
| 1342 |
\& OS400 os400 os400 |
| 1343 |
\& POSIX\-BC posix\-bc BS2000\-posix\-bc |
| 1344 |
.Ve |
| 1345 |
.PP |
| 1346 |
Some simple tricks for determining if you are running on an EBCDIC |
| 1347 |
platform could include any of the following (perhaps all): |
| 1348 |
.PP |
| 1349 |
.Vb 1 |
| 1350 |
\& if ("\et" eq "\e005") { print "EBCDIC may be spoken here!\en"; } |
| 1351 |
\& |
| 1352 |
\& if (ord(\*(AqA\*(Aq) == 193) { print "EBCDIC may be spoken here!\en"; } |
| 1353 |
\& |
| 1354 |
\& if (chr(169) eq \*(Aqz\*(Aq) { print "EBCDIC may be spoken here!\en"; } |
| 1355 |
.Ve |
| 1356 |
.PP |
| 1357 |
One thing you may not want to rely on is the EBCDIC encoding |
| 1358 |
of punctuation characters since these may differ from code page to code |
| 1359 |
page (and once your module or script is rumoured to work with EBCDIC, |
| 1360 |
folks will want it to work with all EBCDIC character sets). |
| 1361 |
.PP |
| 1362 |
Also see: |
| 1363 |
.IP \(bu 4 |
| 1364 |
perlos390, perlos400, perlbs2000, perlebcdic. |
| 1365 |
.IP \(bu 4 |
| 1366 |
The perl\[email protected] list is for discussion of porting issues as well as |
| 1367 |
general usage issues for all EBCDIC Perls. Send a message body of |
| 1368 |
"subscribe perl-mvs" to [email protected]. |
| 1369 |
.IP \(bu 4 |
| 1370 |
AS/400 Perl information at |
| 1371 |
<http://as400.rochester.ibm.com/> |
| 1372 |
as well as on CPAN in the \fIports/\fR directory. |
| 1373 |
.SS "Acorn RISC OS" |
| 1374 |
.IX Subsection "Acorn RISC OS" |
| 1375 |
Because Acorns use ASCII with newlines (\f(CW\*(C`\en\*(C'\fR) in text files as \f(CW\*(C`\e012\*(C'\fR like |
| 1376 |
Unix, and because Unix filename emulation is turned on by default, |
| 1377 |
most simple scripts will probably work "out of the box". The native |
| 1378 |
filesystem is modular, and individual filesystems are free to be |
| 1379 |
case-sensitive or insensitive, and are usually case-preserving. Some |
| 1380 |
native filesystems have name length limits, which file and directory |
| 1381 |
names are silently truncated to fit. Scripts should be aware that the |
| 1382 |
standard filesystem currently has a name length limit of \fB10\fR |
| 1383 |
characters, with up to 77 items in a directory, but other filesystems |
| 1384 |
may not impose such limitations. |
| 1385 |
.PP |
| 1386 |
Native filenames are of the form |
| 1387 |
.PP |
| 1388 |
.Vb 1 |
| 1389 |
\& Filesystem#Special_Field::DiskName.$.Directory.Directory.File |
| 1390 |
.Ve |
| 1391 |
.PP |
| 1392 |
where |
| 1393 |
.PP |
| 1394 |
.Vb 8 |
| 1395 |
\& Special_Field is not usually present, but may contain . and $ . |
| 1396 |
\& Filesystem =~ m|[A\-Za\-z0\-9_]| |
| 1397 |
\& DsicName =~ m|[A\-Za\-z0\-9_/]| |
| 1398 |
\& $ represents the root directory |
| 1399 |
\& . is the path separator |
| 1400 |
\& @ is the current directory (per filesystem but machine global) |
| 1401 |
\& ^ is the parent directory |
| 1402 |
\& Directory and File =~ m|[^\e0\- "\e.\e$\e%\e&:\e@\e\e^\e|\e177]+| |
| 1403 |
.Ve |
| 1404 |
.PP |
| 1405 |
The default filename translation is roughly \f(CW\*(C`tr|/.|./|\*(C'\fR, swapping dots |
| 1406 |
and slashes. |
| 1407 |
.PP |
| 1408 |
Note that \f(CW\*(C`"ADFS::HardDisk.$.File" ne \*(AqADFS::HardDisk.$.File\*(Aq\*(C'\fR and that |
| 1409 |
the second stage of \f(CW\*(C`$\*(C'\fR interpolation in regular expressions will fall |
| 1410 |
foul of the \f(CW$.\fR variable if scripts are not careful. |
| 1411 |
.PP |
| 1412 |
Logical paths specified by system variables containing comma-separated |
| 1413 |
search lists are also allowed; hence \f(CW\*(C`System:Modules\*(C'\fR is a valid |
| 1414 |
filename, and the filesystem will prefix \f(CW\*(C`Modules\*(C'\fR with each section of |
| 1415 |
\&\f(CW\*(C`System$Path\*(C'\fR until a name is made that points to an object on disk. |
| 1416 |
Writing to a new file \f(CW\*(C`System:Modules\*(C'\fR would be allowed only if |
| 1417 |
\&\f(CW\*(C`System$Path\*(C'\fR contains a single item list. The filesystem will also |
| 1418 |
expand system variables in filenames if enclosed in angle brackets, so |
| 1419 |
\&\f(CW\*(C`<System$Dir>.Modules\*(C'\fR would look for the file |
| 1420 |
\&\f(CW\*(C`$ENV{\*(AqSystem$Dir\*(Aq}\ .\ \*(AqModules\*(Aq\*(C'\fR. The obvious implication of this is |
| 1421 |
that \fBfully qualified filenames can start with \fR\f(CB\*(C`<>\*(C'\fR and the |
| 1422 |
three-argument form of \f(CW\*(C`open\*(C'\fR should |
| 1423 |
always be used. |
| 1424 |
.PP |
| 1425 |
Because \f(CW\*(C`.\*(C'\fR was in use as a directory separator and filenames could not |
| 1426 |
be assumed to be unique after 10 characters, Acorn implemented the C |
| 1427 |
compiler to strip the trailing \f(CW\*(C`.c\*(C'\fR \f(CW\*(C`.h\*(C'\fR \f(CW\*(C`.s\*(C'\fR and \f(CW\*(C`.o\*(C'\fR suffix from |
| 1428 |
filenames specified in source code and store the respective files in |
| 1429 |
subdirectories named after the suffix. Hence files are translated: |
| 1430 |
.PP |
| 1431 |
.Vb 6 |
| 1432 |
\& foo.h h.foo |
| 1433 |
\& C:foo.h C:h.foo (logical path variable) |
| 1434 |
\& sys/os.h sys.h.os (C compiler groks Unix\-speak) |
| 1435 |
\& 10charname.c c.10charname |
| 1436 |
\& 10charname.o o.10charname |
| 1437 |
\& 11charname_.c c.11charname (assuming filesystem truncates at 10) |
| 1438 |
.Ve |
| 1439 |
.PP |
| 1440 |
The Unix emulation library's translation of filenames to native assumes |
| 1441 |
that this sort of translation is required, and it allows a user-defined list |
| 1442 |
of known suffixes that it will transpose in this fashion. This may |
| 1443 |
seem transparent, but consider that with these rules \fIfoo/bar/baz.h\fR |
| 1444 |
and \fIfoo/bar/h/baz\fR both map to \fIfoo.bar.h.baz\fR, and that |
| 1445 |
\&\f(CW\*(C`readdir\*(C'\fR and \f(CW\*(C`glob\*(C'\fR |
| 1446 |
cannot and do not attempt to emulate the reverse mapping. Other |
| 1447 |
\&\f(CW\*(C`.\*(C'\fR's in filenames are translated to \f(CW\*(C`/\*(C'\fR. |
| 1448 |
.PP |
| 1449 |
As implied above, the environment accessed through |
| 1450 |
\&\f(CW%ENV\fR is global, and the convention is that program |
| 1451 |
specific environment variables are of the form \f(CW\*(C`Program$Name\*(C'\fR. |
| 1452 |
Each filesystem maintains a current directory, |
| 1453 |
and the current filesystem's current directory is the \fBglobal\fR current |
| 1454 |
directory. Consequently, sociable programs don't change the current |
| 1455 |
directory but rely on full pathnames, and programs (and Makefiles) cannot |
| 1456 |
assume that they can spawn a child process which can change the current |
| 1457 |
directory without affecting its parent (and everyone else for that |
| 1458 |
matter). |
| 1459 |
.PP |
| 1460 |
Because native operating system filehandles are global and are currently |
| 1461 |
allocated down from 255, with 0 being a reserved value, the Unix emulation |
| 1462 |
library emulates Unix filehandles. Consequently, you can't rely on |
| 1463 |
passing \f(CW\*(C`STDIN\*(C'\fR, \f(CW\*(C`STDOUT\*(C'\fR, or \f(CW\*(C`STDERR\*(C'\fR to your children. |
| 1464 |
.PP |
| 1465 |
The desire of users to express filenames of the form |
| 1466 |
\&\f(CW\*(C`<Foo$Dir>.Bar\*(C'\fR on the command line unquoted causes problems, |
| 1467 |
too: \f(CW\`\`\fR command output capture has |
| 1468 |
to perform a guessing game. It assumes that a string \f(CW\*(C`<[^<>]+\e$[^<>]>\*(C'\fR |
| 1469 |
is a reference to an environment variable, whereas anything else involving |
| 1470 |
\&\f(CW\*(C`<\*(C'\fR or \f(CW\*(C`>\*(C'\fR is redirection, and generally manages to be 99% |
| 1471 |
right. Of course, the problem remains that scripts cannot rely on any |
| 1472 |
Unix tools being available, or that any tools found have Unix-like command |
| 1473 |
line arguments. |
| 1474 |
.PP |
| 1475 |
Extensions and XS are, in theory, buildable by anyone using free |
| 1476 |
tools. In practice, many don't, as users of the Acorn platform are |
| 1477 |
used to binary distributions. MakeMaker does run, but no available |
| 1478 |
make currently copes with MakeMaker's makefiles; even if and when |
| 1479 |
this should be fixed, the lack of a Unix-like shell will cause |
| 1480 |
problems with makefile rules, especially lines of the form |
| 1481 |
\&\f(CW\*(C`cd sdbm && make all\*(C'\fR, and anything using quoting. |
| 1482 |
.PP |
| 1483 |
"RISC\ OS" is the proper name for the operating system, but the value |
| 1484 |
in \f(CW$^O\fR is "riscos" (because we don't like shouting). |
| 1485 |
.SS "Other perls" |
| 1486 |
.IX Subsection "Other perls" |
| 1487 |
Perl has been ported to many platforms that do not fit into any of |
| 1488 |
the categories listed above. Some, such as AmigaOS, |
| 1489 |
QNX, Plan 9, and VOS, have been well-integrated into the standard |
| 1490 |
Perl source code kit. You may need to see the \fIports/\fR directory |
| 1491 |
on CPAN for information, and possibly binaries, for the likes of: |
| 1492 |
aos, Atari ST, lynxos, riscos, Novell Netware, Tandem Guardian, |
| 1493 |
\&\fIetc.\fR (Yes, we know that some of these OSes may fall under the |
| 1494 |
Unix category, but we are not a standards body.) |
| 1495 |
.PP |
| 1496 |
Some approximate operating system names and their \f(CW$^O\fR |
| 1497 |
values in the "OTHER" category include: |
| 1498 |
.PP |
| 1499 |
.Vb 3 |
| 1500 |
\& OS $^O $Config{archname} |
| 1501 |
\& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- |
| 1502 |
\& Amiga DOS amigaos m68k\-amigos |
| 1503 |
.Ve |
| 1504 |
.PP |
| 1505 |
See also: |
| 1506 |
.IP \(bu 4 |
| 1507 |
Amiga, \fIREADME.amiga\fR (installed as perlamiga). |
| 1508 |
.IP \(bu 4 |
| 1509 |
Plan\ 9, \fIREADME.plan9\fR |
| 1510 |
.SH "FUNCTION IMPLEMENTATIONS" |
| 1511 |
.IX Header "FUNCTION IMPLEMENTATIONS" |
| 1512 |
Listed below are functions that are either completely unimplemented |
| 1513 |
or else have been implemented differently on various platforms. |
| 1514 |
Preceding each description will be, in parentheses, a list of |
| 1515 |
platforms that the description applies to. |
| 1516 |
.PP |
| 1517 |
The list may well be incomplete, or even wrong in some places. When |
| 1518 |
in doubt, consult the platform-specific README files in the Perl |
| 1519 |
source distribution, and any other documentation resources accompanying |
| 1520 |
a given port. |
| 1521 |
.PP |
| 1522 |
Be aware, moreover, that even among Unix-ish systems there are variations. |
| 1523 |
.PP |
| 1524 |
For many functions, you can also query \f(CW%Config\fR, |
| 1525 |
exported by default from the \f(CW\*(C`Config\*(C'\fR module. For example, to |
| 1526 |
check whether the platform has the \f(CW\*(C`lstat\*(C'\fR |
| 1527 |
call, check \f(CW$Config{d_lstat}\fR. See Config for a |
| 1528 |
full description of available variables. |
| 1529 |
.SS "Alphabetical Listing of Perl Functions" |
| 1530 |
.IX Subsection "Alphabetical Listing of Perl Functions" |
| 1531 |
.IP \-X 8 |
| 1532 |
.IX Item "-X" |
| 1533 |
(Win32) |
| 1534 |
\&\f(CW\*(C`\-w\*(C'\fR only inspects the read-only file attribute (FILE_ATTRIBUTE_READONLY), |
| 1535 |
which determines whether the directory can be deleted, not whether it can |
| 1536 |
be written to. Directories always have read and write access unless denied |
| 1537 |
by discretionary access control lists (DACLs). |
| 1538 |
.Sp |
| 1539 |
(VMS) |
| 1540 |
\&\f(CW\*(C`\-r\*(C'\fR, \f(CW\*(C`\-w\*(C'\fR, \f(CW\*(C`\-x\*(C'\fR, and \f(CW\*(C`\-o\*(C'\fR tell whether the file is accessible, |
| 1541 |
which may not reflect UIC-based file protections. |
| 1542 |
.Sp |
| 1543 |
(RISC\ OS) |
| 1544 |
\&\f(CW\*(C`\-s\*(C'\fR by name on an open file will return the space reserved on disk, |
| 1545 |
rather than the current extent. \f(CW\*(C`\-s\*(C'\fR on an open filehandle returns the |
| 1546 |
current size. |
| 1547 |
.Sp |
| 1548 |
(Win32, VMS, RISC\ OS) |
| 1549 |
\&\f(CW\*(C`\-R\*(C'\fR, \f(CW\*(C`\-W\*(C'\fR, \f(CW\*(C`\-X\*(C'\fR, \f(CW\*(C`\-O\*(C'\fR are indistinguishable from \f(CW\*(C`\-r\*(C'\fR, \f(CW\*(C`\-w\*(C'\fR, |
| 1550 |
\&\f(CW\*(C`\-x\*(C'\fR, \f(CW\*(C`\-o\*(C'\fR. |
| 1551 |
.Sp |
| 1552 |
(Win32, VMS, RISC\ OS) |
| 1553 |
\&\f(CW\*(C`\-g\*(C'\fR, \f(CW\*(C`\-k\*(C'\fR, \f(CW\*(C`\-u\*(C'\fR, \f(CW\*(C`\-A\*(C'\fR are not particularly meaningful. |
| 1554 |
.Sp |
| 1555 |
(VMS, RISC\ OS) |
| 1556 |
\&\f(CW\*(C`\-l\*(C'\fR is not particularly meaningful. |
| 1557 |
.Sp |
| 1558 |
(Win32) |
| 1559 |
\&\f(CW\*(C`\-l\*(C'\fR returns true for both symlinks and directory junctions. |
| 1560 |
.Sp |
| 1561 |
(VMS, RISC\ OS) |
| 1562 |
\&\f(CW\*(C`\-p\*(C'\fR is not particularly meaningful. |
| 1563 |
.Sp |
| 1564 |
(VMS) |
| 1565 |
\&\f(CW\*(C`\-d\*(C'\fR is true if passed a device spec without an explicit directory. |
| 1566 |
.Sp |
| 1567 |
(Win32) |
| 1568 |
\&\f(CW\*(C`\-x\*(C'\fR (or \f(CW\*(C`\-X\*(C'\fR) determine if a file ends in one of the executable |
| 1569 |
suffixes. |
| 1570 |
.Sp |
| 1571 |
(RISC\ OS) |
| 1572 |
\&\f(CW\*(C`\-x\*(C'\fR (or \f(CW\*(C`\-X\*(C'\fR) determine if a file has an executable file type. |
| 1573 |
.IP alarm 8 |
| 1574 |
.IX Item "alarm" |
| 1575 |
(Win32) |
| 1576 |
Emulated using timers that must be explicitly polled whenever Perl |
| 1577 |
wants to dispatch "safe signals" and therefore cannot interrupt |
| 1578 |
blocking system calls. |
| 1579 |
.IP atan2 8 |
| 1580 |
.IX Item "atan2" |
| 1581 |
(Tru64, HP-UX 10.20) |
| 1582 |
Due to issues with various CPUs, math libraries, compilers, and standards, |
| 1583 |
results for \f(CW\*(C`atan2\*(C'\fR may vary depending on any combination of the above. |
| 1584 |
Perl attempts to conform to the Open Group/IEEE standards for the results |
| 1585 |
returned from \f(CW\*(C`atan2\*(C'\fR, but cannot force the issue if the system Perl is |
| 1586 |
run on does not allow it. |
| 1587 |
.Sp |
| 1588 |
The current version of the standards for \f(CW\*(C`atan2\*(C'\fR is available at |
| 1589 |
<http://www.opengroup.org/onlinepubs/009695399/functions/atan2.html>. |
| 1590 |
.IP binmode 8 |
| 1591 |
.IX Item "binmode" |
| 1592 |
(RISC\ OS) |
| 1593 |
Meaningless. |
| 1594 |
.Sp |
| 1595 |
(VMS) |
| 1596 |
Reopens file and restores pointer; if function fails, underlying |
| 1597 |
filehandle may be closed, or pointer may be in a different position. |
| 1598 |
.Sp |
| 1599 |
(Win32) |
| 1600 |
The value returned by \f(CW\*(C`tell\*(C'\fR may be affected |
| 1601 |
after the call, and the filehandle may be flushed. |
| 1602 |
.IP chdir 8 |
| 1603 |
.IX Item "chdir" |
| 1604 |
(Win32) |
| 1605 |
The current directory reported by the system may include any symbolic |
| 1606 |
links specified to \fBchdir()\fR. |
| 1607 |
.IP chmod 8 |
| 1608 |
.IX Item "chmod" |
| 1609 |
(Win32) |
| 1610 |
Only good for changing "owner" read-write access; "group" and "other" |
| 1611 |
bits are meaningless. |
| 1612 |
.Sp |
| 1613 |
(RISC\ OS) |
| 1614 |
Only good for changing "owner" and "other" read-write access. |
| 1615 |
.Sp |
| 1616 |
(VOS) |
| 1617 |
Access permissions are mapped onto VOS access-control list changes. |
| 1618 |
.Sp |
| 1619 |
(Cygwin) |
| 1620 |
The actual permissions set depend on the value of the \f(CW\*(C`CYGWIN\*(C'\fR variable |
| 1621 |
in the SYSTEM environment settings. |
| 1622 |
.Sp |
| 1623 |
(Android) |
| 1624 |
Setting the exec bit on some locations (generally \fI/sdcard\fR) will return true |
| 1625 |
but not actually set the bit. |
| 1626 |
.Sp |
| 1627 |
(VMS) |
| 1628 |
A mode argument of zero sets permissions to the user's default permission mask |
| 1629 |
rather than disabling all permissions. |
| 1630 |
.IP chown 8 |
| 1631 |
.IX Item "chown" |
| 1632 |
(Plan\ 9, RISC\ OS) |
| 1633 |
Not implemented. |
| 1634 |
.Sp |
| 1635 |
(Win32) |
| 1636 |
Does nothing, but won't fail. |
| 1637 |
.Sp |
| 1638 |
(VOS) |
| 1639 |
A little funky, because VOS's notion of ownership is a little funky. |
| 1640 |
.IP chroot 8 |
| 1641 |
.IX Item "chroot" |
| 1642 |
(Win32, VMS, Plan\ 9, RISC\ OS, VOS) |
| 1643 |
Not implemented. |
| 1644 |
.IP crypt 8 |
| 1645 |
.IX Item "crypt" |
| 1646 |
(Win32) |
| 1647 |
May not be available if library or source was not provided when building |
| 1648 |
perl. |
| 1649 |
.Sp |
| 1650 |
(Android) |
| 1651 |
Not implemented. |
| 1652 |
.IP dbmclose 8 |
| 1653 |
.IX Item "dbmclose" |
| 1654 |
(VMS, Plan\ 9, VOS) |
| 1655 |
Not implemented. |
| 1656 |
.IP dbmopen 8 |
| 1657 |
.IX Item "dbmopen" |
| 1658 |
(VMS, Plan\ 9, VOS) |
| 1659 |
Not implemented. |
| 1660 |
.IP dump 8 |
| 1661 |
.IX Item "dump" |
| 1662 |
(RISC\ OS) |
| 1663 |
Not useful. |
| 1664 |
.Sp |
| 1665 |
(Cygwin, Win32) |
| 1666 |
Not supported. |
| 1667 |
.Sp |
| 1668 |
(VMS) |
| 1669 |
Invokes VMS debugger. |
| 1670 |
.IP exec 8 |
| 1671 |
.IX Item "exec" |
| 1672 |
(Win32) |
| 1673 |
\&\f(CW\*(C`exec LIST\*(C'\fR without the use of indirect object syntax (\f(CW\*(C`exec PROGRAM LIST\*(C'\fR) |
| 1674 |
may fall back to trying the shell if the first \f(CWspawn()\fR fails. |
| 1675 |
.Sp |
| 1676 |
Note that the list form of \fBexec()\fR is emulated since the Win32 API |
| 1677 |
\&\fBCreateProcess()\fR accepts a simple string rather than an array of |
| 1678 |
command-line arguments. This may have security implications for your |
| 1679 |
code. |
| 1680 |
.Sp |
| 1681 |
(SunOS, Solaris, HP-UX) |
| 1682 |
Does not automatically flush output handles on some platforms. |
| 1683 |
.IP exit 8 |
| 1684 |
.IX Item "exit" |
| 1685 |
(VMS) |
| 1686 |
Emulates Unix \f(CW\*(C`exit\*(C'\fR (which considers \f(CW\*(C`exit 1\*(C'\fR to indicate an error) by |
| 1687 |
mapping the \f(CW1\fR to \f(CW\*(C`SS$_ABORT\*(C'\fR (\f(CW44\fR). This behavior may be overridden |
| 1688 |
with the pragma \f(CW\*(C`use vmsish \*(Aqexit\*(Aq\*(C'\fR. As with |
| 1689 |
the CRTL's \f(CWexit()\fR function, \f(CW\*(C`exit 0\*(C'\fR is also mapped to an exit status |
| 1690 |
of \f(CW\*(C`SS$_NORMAL\*(C'\fR (\f(CW1\fR); this mapping cannot be overridden. Any other |
| 1691 |
argument to \f(CW\*(C`exit\*(C'\fR |
| 1692 |
is used directly as Perl's exit status. On VMS, unless the future |
| 1693 |
POSIX_EXIT mode is enabled, the exit code should always be a valid |
| 1694 |
VMS exit code and not a generic number. When the POSIX_EXIT mode is |
| 1695 |
enabled, a generic number will be encoded in a method compatible with |
| 1696 |
the C library _POSIX_EXIT macro so that it can be decoded by other |
| 1697 |
programs, particularly ones written in C, like the GNV package. |
| 1698 |
.Sp |
| 1699 |
(Solaris) |
| 1700 |
\&\f(CW\*(C`exit\*(C'\fR resets file pointers, which is a problem when called |
| 1701 |
from a child process (created by \f(CW\*(C`fork\*(C'\fR) in |
| 1702 |
\&\f(CW\*(C`BEGIN\*(C'\fR. |
| 1703 |
A workaround is to use \f(CW\*(C`POSIX::_exit\*(C'\fR. |
| 1704 |
.Sp |
| 1705 |
.Vb 3 |
| 1706 |
\& exit unless $Config{archname} =~ /\ebsolaris\eb/; |
| 1707 |
\& require POSIX; |
| 1708 |
\& POSIX::_exit(0); |
| 1709 |
.Ve |
| 1710 |
.IP fcntl 8 |
| 1711 |
.IX Item "fcntl" |
| 1712 |
(Win32) |
| 1713 |
Not implemented. |
| 1714 |
.Sp |
| 1715 |
(VMS) |
| 1716 |
Some functions available based on the version of VMS. |
| 1717 |
.IP flock 8 |
| 1718 |
.IX Item "flock" |
| 1719 |
(VMS, RISC\ OS, VOS) |
| 1720 |
Not implemented. |
| 1721 |
.IP fork 8 |
| 1722 |
.IX Item "fork" |
| 1723 |
(AmigaOS, RISC\ OS, VMS) |
| 1724 |
Not implemented. |
| 1725 |
.Sp |
| 1726 |
(Win32) |
| 1727 |
Emulated using multiple interpreters. See perlfork. |
| 1728 |
.Sp |
| 1729 |
(SunOS, Solaris, HP-UX) |
| 1730 |
Does not automatically flush output handles on some platforms. |
| 1731 |
.IP getlogin 8 |
| 1732 |
.IX Item "getlogin" |
| 1733 |
(RISC\ OS) |
| 1734 |
Not implemented. |
| 1735 |
.IP getpgrp 8 |
| 1736 |
.IX Item "getpgrp" |
| 1737 |
(Win32, VMS, RISC\ OS) |
| 1738 |
Not implemented. |
| 1739 |
.IP getppid 8 |
| 1740 |
.IX Item "getppid" |
| 1741 |
(Win32, RISC\ OS) |
| 1742 |
Not implemented. |
| 1743 |
.IP getpriority 8 |
| 1744 |
.IX Item "getpriority" |
| 1745 |
(Win32, VMS, RISC\ OS, VOS) |
| 1746 |
Not implemented. |
| 1747 |
.IP getpwnam 8 |
| 1748 |
.IX Item "getpwnam" |
| 1749 |
(Win32) |
| 1750 |
Not implemented. |
| 1751 |
.Sp |
| 1752 |
(RISC\ OS) |
| 1753 |
Not useful. |
| 1754 |
.IP getgrnam 8 |
| 1755 |
.IX Item "getgrnam" |
| 1756 |
(Win32, VMS, RISC\ OS) |
| 1757 |
Not implemented. |
| 1758 |
.IP getnetbyname 8 |
| 1759 |
.IX Item "getnetbyname" |
| 1760 |
(Android, Win32, Plan\ 9) |
| 1761 |
Not implemented. |
| 1762 |
.IP getpwuid 8 |
| 1763 |
.IX Item "getpwuid" |
| 1764 |
(Win32) |
| 1765 |
Not implemented. |
| 1766 |
.Sp |
| 1767 |
(RISC\ OS) |
| 1768 |
Not useful. |
| 1769 |
.IP getgrgid 8 |
| 1770 |
.IX Item "getgrgid" |
| 1771 |
(Win32, VMS, RISC\ OS) |
| 1772 |
Not implemented. |
| 1773 |
.IP getnetbyaddr 8 |
| 1774 |
.IX Item "getnetbyaddr" |
| 1775 |
(Android, Win32, Plan\ 9) |
| 1776 |
Not implemented. |
| 1777 |
.IP getprotobynumber 8 |
| 1778 |
.IX Item "getprotobynumber" |
| 1779 |
(Android) |
| 1780 |
Not implemented. |
| 1781 |
.IP getpwent 8 |
| 1782 |
.IX Item "getpwent" |
| 1783 |
(Android, Win32) |
| 1784 |
Not implemented. |
| 1785 |
.IP getgrent 8 |
| 1786 |
.IX Item "getgrent" |
| 1787 |
(Android, Win32, VMS) |
| 1788 |
Not implemented. |
| 1789 |
.IP gethostbyname 8 |
| 1790 |
.IX Item "gethostbyname" |
| 1791 |
(Irix\ 5) |
| 1792 |
\&\f(CWgethostbyname(\*(Aqlocalhost\*(Aq)\fR does not work everywhere: you may have |
| 1793 |
to use \f(CWgethostbyname(\*(Aq127.0.0.1\*(Aq)\fR. |
| 1794 |
.IP gethostent 8 |
| 1795 |
.IX Item "gethostent" |
| 1796 |
(Win32) |
| 1797 |
Not implemented. |
| 1798 |
.IP getnetent 8 |
| 1799 |
.IX Item "getnetent" |
| 1800 |
(Android, Win32, Plan\ 9) |
| 1801 |
Not implemented. |
| 1802 |
.IP getprotoent 8 |
| 1803 |
.IX Item "getprotoent" |
| 1804 |
(Android, Win32, Plan\ 9) |
| 1805 |
Not implemented. |
| 1806 |
.IP getservent 8 |
| 1807 |
.IX Item "getservent" |
| 1808 |
(Win32, Plan\ 9) |
| 1809 |
Not implemented. |
| 1810 |
.IP seekdir 8 |
| 1811 |
.IX Item "seekdir" |
| 1812 |
(Android) |
| 1813 |
Not implemented. |
| 1814 |
.IP sethostent 8 |
| 1815 |
.IX Item "sethostent" |
| 1816 |
(Android, Win32, Plan\ 9, RISC\ OS) |
| 1817 |
Not implemented. |
| 1818 |
.IP setnetent 8 |
| 1819 |
.IX Item "setnetent" |
| 1820 |
(Win32, Plan\ 9, RISC\ OS) |
| 1821 |
Not implemented. |
| 1822 |
.IP setprotoent 8 |
| 1823 |
.IX Item "setprotoent" |
| 1824 |
(Android, Win32, Plan\ 9, RISC\ OS) |
| 1825 |
Not implemented. |
| 1826 |
.IP setservent 8 |
| 1827 |
.IX Item "setservent" |
| 1828 |
(Plan\ 9, Win32, RISC\ OS) |
| 1829 |
Not implemented. |
| 1830 |
.IP endpwent 8 |
| 1831 |
.IX Item "endpwent" |
| 1832 |
(Win32) |
| 1833 |
Not implemented. |
| 1834 |
.Sp |
| 1835 |
(Android) |
| 1836 |
Either not implemented or a no-op. |
| 1837 |
.IP endgrent 8 |
| 1838 |
.IX Item "endgrent" |
| 1839 |
(Android, RISC\ OS, VMS, Win32) |
| 1840 |
Not implemented. |
| 1841 |
.IP endhostent 8 |
| 1842 |
.IX Item "endhostent" |
| 1843 |
(Android, Win32) |
| 1844 |
Not implemented. |
| 1845 |
.IP endnetent 8 |
| 1846 |
.IX Item "endnetent" |
| 1847 |
(Android, Win32, Plan\ 9) |
| 1848 |
Not implemented. |
| 1849 |
.IP endprotoent 8 |
| 1850 |
.IX Item "endprotoent" |
| 1851 |
(Android, Win32, Plan\ 9) |
| 1852 |
Not implemented. |
| 1853 |
.IP endservent 8 |
| 1854 |
.IX Item "endservent" |
| 1855 |
(Plan\ 9, Win32) |
| 1856 |
Not implemented. |
| 1857 |
.IP getsockopt 8 |
| 1858 |
.IX Item "getsockopt" |
| 1859 |
(Plan\ 9) |
| 1860 |
Not implemented. |
| 1861 |
.IP glob 8 |
| 1862 |
.IX Item "glob" |
| 1863 |
This operator is implemented via the \f(CW\*(C`File::Glob\*(C'\fR extension |
| 1864 |
on most platforms. See File::Glob for portability information. |
| 1865 |
.IP gmtime 8 |
| 1866 |
.IX Item "gmtime" |
| 1867 |
In theory, \f(CW\*(C`gmtime\*(C'\fR is reliable from \-2**63 to 2**63\-1. However, |
| 1868 |
because work-arounds in the implementation use floating point numbers, |
| 1869 |
it will become inaccurate as the time gets larger. This is a bug and |
| 1870 |
will be fixed in the future. |
| 1871 |
.Sp |
| 1872 |
(VOS) |
| 1873 |
Time values are 32\-bit quantities. |
| 1874 |
.IP ioctl 8 |
| 1875 |
.IX Item "ioctl" |
| 1876 |
(VMS) |
| 1877 |
Not implemented. |
| 1878 |
.Sp |
| 1879 |
(Win32) |
| 1880 |
Available only for socket handles, and it does what the \f(CWioctlsocket()\fR call |
| 1881 |
in the Winsock API does. |
| 1882 |
.Sp |
| 1883 |
(RISC\ OS) |
| 1884 |
Available only for socket handles. |
| 1885 |
.IP kill 8 |
| 1886 |
.IX Item "kill" |
| 1887 |
(RISC\ OS) |
| 1888 |
Not implemented, hence not useful for taint checking. |
| 1889 |
.Sp |
| 1890 |
(Win32) |
| 1891 |
\&\f(CW\*(C`kill\*(C'\fR doesn't send a signal to the identified process like it does on |
| 1892 |
Unix platforms. Instead \f(CW\*(C`kill($sig, $pid)\*(C'\fR terminates the process |
| 1893 |
identified by \f(CW$pid\fR, and makes it exit immediately with exit status |
| 1894 |
\&\f(CW$sig\fR. As in Unix, if \f(CW$sig\fR is 0 and the specified process exists, it |
| 1895 |
returns true without actually terminating it. |
| 1896 |
.Sp |
| 1897 |
(Win32) |
| 1898 |
\&\f(CW\*(C`kill(\-9, $pid)\*(C'\fR will terminate the process specified by \f(CW$pid\fR and |
| 1899 |
recursively all child processes owned by it. This is different from |
| 1900 |
the Unix semantics, where the signal will be delivered to all |
| 1901 |
processes in the same process group as the process specified by |
| 1902 |
\&\f(CW$pid\fR. |
| 1903 |
.Sp |
| 1904 |
(VMS) |
| 1905 |
A pid of \-1 indicating all processes on the system is not currently |
| 1906 |
supported. |
| 1907 |
.IP link 8 |
| 1908 |
.IX Item "link" |
| 1909 |
(RISC\ OS, VOS) |
| 1910 |
Not implemented. |
| 1911 |
.Sp |
| 1912 |
(AmigaOS) |
| 1913 |
Link count not updated because hard links are not quite that hard |
| 1914 |
(They are sort of half-way between hard and soft links). |
| 1915 |
.Sp |
| 1916 |
(Win32) |
| 1917 |
Hard links are implemented on Win32 under NTFS only. They are |
| 1918 |
natively supported on Windows 2000 and later. On Windows NT they |
| 1919 |
are implemented using the Windows POSIX subsystem support and the |
| 1920 |
Perl process will need Administrator or Backup Operator privileges |
| 1921 |
to create hard links. |
| 1922 |
.Sp |
| 1923 |
(VMS) |
| 1924 |
Available on 64 bit OpenVMS 8.2 and later. |
| 1925 |
.IP localtime 8 |
| 1926 |
.IX Item "localtime" |
| 1927 |
\&\f(CW\*(C`localtime\*(C'\fR has the same range as "gmtime", but because time zone |
| 1928 |
rules change, its accuracy for historical and future times may degrade |
| 1929 |
but usually by no more than an hour. |
| 1930 |
.IP lstat 8 |
| 1931 |
.IX Item "lstat" |
| 1932 |
(RISC\ OS) |
| 1933 |
Not implemented. |
| 1934 |
.Sp |
| 1935 |
(Win32) |
| 1936 |
Treats directory junctions as symlinks. |
| 1937 |
.IP msgctl 8 |
| 1938 |
.IX Item "msgctl" |
| 1939 |
.PD 0 |
| 1940 |
.IP msgget 8 |
| 1941 |
.IX Item "msgget" |
| 1942 |
.IP msgsnd 8 |
| 1943 |
.IX Item "msgsnd" |
| 1944 |
.IP msgrcv 8 |
| 1945 |
.IX Item "msgrcv" |
| 1946 |
.PD |
| 1947 |
(Android, Win32, VMS, Plan\ 9, RISC\ OS, VOS) |
| 1948 |
Not implemented. |
| 1949 |
.IP open 8 |
| 1950 |
.IX Item "open" |
| 1951 |
(RISC\ OS) |
| 1952 |
Open modes \f(CW\*(C`|\-\*(C'\fR and \f(CW\*(C`\-|\*(C'\fR are unsupported. |
| 1953 |
.Sp |
| 1954 |
(SunOS, Solaris, HP-UX) |
| 1955 |
Opening a process does not automatically flush output handles on some |
| 1956 |
platforms. |
| 1957 |
.Sp |
| 1958 |
(Win32) |
| 1959 |
Both of modes \f(CW\*(C`|\-\*(C'\fR and \f(CW\*(C`\-|\*(C'\fR are supported, but the list form is |
| 1960 |
emulated since the Win32 API \fBCreateProcess()\fR accepts a simple string |
| 1961 |
rather than an array of arguments. This may have security |
| 1962 |
implications for your code. |
| 1963 |
.IP readlink 8 |
| 1964 |
.IX Item "readlink" |
| 1965 |
(VMS, RISC\ OS) |
| 1966 |
Not implemented. |
| 1967 |
.Sp |
| 1968 |
(Win32) |
| 1969 |
\&\fBreadlink()\fR on a directory junction returns the object name, not a |
| 1970 |
simple path. |
| 1971 |
.IP rename 8 |
| 1972 |
.IX Item "rename" |
| 1973 |
(Win32) |
| 1974 |
Can't move directories between directories on different logical volumes. |
| 1975 |
.IP rewinddir 8 |
| 1976 |
.IX Item "rewinddir" |
| 1977 |
(Win32) |
| 1978 |
Will not cause \f(CW\*(C`readdir\*(C'\fR to re-read the |
| 1979 |
directory stream. The entries already read before the \f(CW\*(C`rewinddir\*(C'\fR call |
| 1980 |
will just be returned again from a cache buffer. |
| 1981 |
.IP select 8 |
| 1982 |
.IX Item "select" |
| 1983 |
(Win32, VMS) |
| 1984 |
Only implemented on sockets. |
| 1985 |
.Sp |
| 1986 |
(RISC\ OS) |
| 1987 |
Only reliable on sockets. |
| 1988 |
.Sp |
| 1989 |
Note that the \f(CW\*(C`select FILEHANDLE\*(C'\fR form is |
| 1990 |
generally portable. |
| 1991 |
.IP semctl 8 |
| 1992 |
.IX Item "semctl" |
| 1993 |
.PD 0 |
| 1994 |
.IP semget 8 |
| 1995 |
.IX Item "semget" |
| 1996 |
.IP semop 8 |
| 1997 |
.IX Item "semop" |
| 1998 |
.PD |
| 1999 |
(Android, Win32, VMS, RISC\ OS) |
| 2000 |
Not implemented. |
| 2001 |
.IP setgrent 8 |
| 2002 |
.IX Item "setgrent" |
| 2003 |
(Android, VMS, Win32, RISC\ OS) |
| 2004 |
Not implemented. |
| 2005 |
.IP setpgrp 8 |
| 2006 |
.IX Item "setpgrp" |
| 2007 |
(Win32, VMS, RISC\ OS, VOS) |
| 2008 |
Not implemented. |
| 2009 |
.IP setpriority 8 |
| 2010 |
.IX Item "setpriority" |
| 2011 |
(Win32, VMS, RISC\ OS, VOS) |
| 2012 |
Not implemented. |
| 2013 |
.IP setpwent 8 |
| 2014 |
.IX Item "setpwent" |
| 2015 |
(Android, Win32, RISC\ OS) |
| 2016 |
Not implemented. |
| 2017 |
.IP setsockopt 8 |
| 2018 |
.IX Item "setsockopt" |
| 2019 |
(Plan\ 9) |
| 2020 |
Not implemented. |
| 2021 |
.IP shmctl 8 |
| 2022 |
.IX Item "shmctl" |
| 2023 |
.PD 0 |
| 2024 |
.IP shmget 8 |
| 2025 |
.IX Item "shmget" |
| 2026 |
.IP shmread 8 |
| 2027 |
.IX Item "shmread" |
| 2028 |
.IP shmwrite 8 |
| 2029 |
.IX Item "shmwrite" |
| 2030 |
.PD |
| 2031 |
(Android, Win32, VMS, RISC\ OS) |
| 2032 |
Not implemented. |
| 2033 |
.IP sleep 8 |
| 2034 |
.IX Item "sleep" |
| 2035 |
(Win32) |
| 2036 |
Emulated using synchronization functions such that it can be |
| 2037 |
interrupted by \f(CW\*(C`alarm\*(C'\fR, and limited to a |
| 2038 |
maximum of 4294967 seconds, approximately 49 days. |
| 2039 |
.IP socketpair 8 |
| 2040 |
.IX Item "socketpair" |
| 2041 |
(RISC\ OS) |
| 2042 |
Not implemented. |
| 2043 |
.Sp |
| 2044 |
(VMS) |
| 2045 |
Available on 64 bit OpenVMS 8.2 and later. |
| 2046 |
.IP stat 8 |
| 2047 |
.IX Item "stat" |
| 2048 |
Platforms that do not have \f(CW\*(C`rdev\*(C'\fR, \f(CW\*(C`blksize\*(C'\fR, or \f(CW\*(C`blocks\*(C'\fR will return |
| 2049 |
these as \f(CW\*(Aq\*(Aq\fR, so numeric comparison or manipulation of these fields may |
| 2050 |
cause 'not numeric' warnings. |
| 2051 |
.Sp |
| 2052 |
(Mac\ OS\ X) |
| 2053 |
\&\f(CW\*(C`ctime\*(C'\fR not supported on UFS. |
| 2054 |
.Sp |
| 2055 |
(Win32) |
| 2056 |
\&\f(CW\*(C`ctime\*(C'\fR is creation time instead of inode change time. |
| 2057 |
.Sp |
| 2058 |
(VMS) |
| 2059 |
\&\f(CW\*(C`dev\*(C'\fR and \f(CW\*(C`ino\*(C'\fR are not necessarily reliable. |
| 2060 |
.Sp |
| 2061 |
(RISC\ OS) |
| 2062 |
\&\f(CW\*(C`mtime\*(C'\fR, \f(CW\*(C`atime\*(C'\fR and \f(CW\*(C`ctime\*(C'\fR all return the last modification time. |
| 2063 |
\&\f(CW\*(C`dev\*(C'\fR and \f(CW\*(C`ino\*(C'\fR are not necessarily reliable. |
| 2064 |
.Sp |
| 2065 |
(OS/2) |
| 2066 |
\&\f(CW\*(C`dev\*(C'\fR, \f(CW\*(C`rdev\*(C'\fR, \f(CW\*(C`blksize\*(C'\fR, and \f(CW\*(C`blocks\*(C'\fR are not available. \f(CW\*(C`ino\*(C'\fR is not |
| 2067 |
meaningful and will differ between stat calls on the same file. |
| 2068 |
.Sp |
| 2069 |
(Cygwin) |
| 2070 |
Some versions of cygwin when doing a \f(CWstat("foo")\fR and not finding it |
| 2071 |
may then attempt to \f(CWstat("foo.exe")\fR. |
| 2072 |
.IP symlink 8 |
| 2073 |
.IX Item "symlink" |
| 2074 |
(RISC\ OS) |
| 2075 |
Not implemented. |
| 2076 |
.Sp |
| 2077 |
(Win32) |
| 2078 |
Requires either elevated permissions or developer mode and a |
| 2079 |
sufficiently recent version of Windows 10. You can check whether the current |
| 2080 |
process has the required privileges using the |
| 2081 |
\&\fBWin32::IsSymlinkCreationAllowed()\fR |
| 2082 |
function. |
| 2083 |
.Sp |
| 2084 |
Since Windows needs to know whether the target is a directory or not when |
| 2085 |
creating the link the target Perl will only create the link as a directory |
| 2086 |
link when the target exists and is a directory. |
| 2087 |
.Sp |
| 2088 |
Windows does not recognize forward slashes as path separators in |
| 2089 |
symbolic links. Hence on Windows, any \f(CW\*(C`/\*(C'\fR in the \fIOLDFILE\fR |
| 2090 |
parameter to \fBsymlink()\fR are converted to \f(CW\*(C`\e\*(C'\fR. This is reflected in |
| 2091 |
the result returned by \fBreadlink()\fR, the \f(CW\*(C`\e\*(C'\fR in the result are not |
| 2092 |
converted back to \f(CW\*(C`/\*(C'\fR. |
| 2093 |
.Sp |
| 2094 |
(VMS) |
| 2095 |
Implemented on 64 bit VMS 8.3. VMS requires the symbolic link to be in Unix |
| 2096 |
syntax if it is intended to resolve to a valid path. |
| 2097 |
.IP syscall 8 |
| 2098 |
.IX Item "syscall" |
| 2099 |
(Win32, VMS, RISC\ OS, VOS) |
| 2100 |
Not implemented. |
| 2101 |
.IP sysopen 8 |
| 2102 |
.IX Item "sysopen" |
| 2103 |
(Mac\ OS, OS/390) |
| 2104 |
The traditional \f(CW0\fR, \f(CW1\fR, and \f(CW2\fR MODEs are implemented with different |
| 2105 |
numeric values on some systems. The flags exported by \f(CW\*(C`Fcntl\*(C'\fR |
| 2106 |
(\f(CW\*(C`O_RDONLY\*(C'\fR, \f(CW\*(C`O_WRONLY\*(C'\fR, \f(CW\*(C`O_RDWR\*(C'\fR) should work everywhere though. |
| 2107 |
.IP system 8 |
| 2108 |
.IX Item "system" |
| 2109 |
(Win32) |
| 2110 |
As an optimization, may not call the command shell specified in |
| 2111 |
\&\f(CW$ENV{PERL5SHELL}\fR. \f(CW\*(C`system(1, @args)\*(C'\fR spawns an external |
| 2112 |
process and immediately returns its process designator, without |
| 2113 |
waiting for it to terminate. Return value may be used subsequently |
| 2114 |
in \f(CW\*(C`wait\*(C'\fR or \f(CW\*(C`waitpid\*(C'\fR. |
| 2115 |
Failure to \f(CWspawn()\fR a subprocess is indicated by setting |
| 2116 |
\&\f(CW$?\fR to \f(CW\*(C`255 << 8\*(C'\fR. \f(CW$?\fR is set in a |
| 2117 |
way compatible with Unix (i.e. the exit status of the subprocess is |
| 2118 |
obtained by \f(CW\*(C`$? >> 8\*(C'\fR, as described in the documentation). |
| 2119 |
.Sp |
| 2120 |
Note that the list form of \fBsystem()\fR is emulated since the Win32 API |
| 2121 |
\&\fBCreateProcess()\fR accepts a simple string rather than an array of |
| 2122 |
command-line arguments. This may have security implications for your |
| 2123 |
code. |
| 2124 |
.Sp |
| 2125 |
(RISC\ OS) |
| 2126 |
There is no shell to process metacharacters, and the native standard is |
| 2127 |
to pass a command line terminated by "\en" "\er" or "\e0" to the spawned |
| 2128 |
program. Redirection such as \f(CW\*(C`> foo\*(C'\fR is performed (if at all) by |
| 2129 |
the run time library of the spawned program. \f(CW\*(C`system LIST\*(C'\fR will call |
| 2130 |
the Unix emulation library's \f(CW\*(C`exec\*(C'\fR emulation, |
| 2131 |
which attempts to provide emulation of the stdin, stdout, stderr in force |
| 2132 |
in the parent, provided the child program uses a compatible version of the |
| 2133 |
emulation library. \f(CW\*(C`system SCALAR\*(C'\fR will call the native command line |
| 2134 |
directly and no such emulation of a child Unix program will occur. |
| 2135 |
Mileage \fBwill\fR vary. |
| 2136 |
.Sp |
| 2137 |
(Win32) |
| 2138 |
\&\f(CW\*(C`system LIST\*(C'\fR without the use of indirect object syntax (\f(CW\*(C`system PROGRAM LIST\*(C'\fR) |
| 2139 |
may fall back to trying the shell if the first \f(CWspawn()\fR fails. |
| 2140 |
.Sp |
| 2141 |
(SunOS, Solaris, HP-UX) |
| 2142 |
Does not automatically flush output handles on some platforms. |
| 2143 |
.Sp |
| 2144 |
(VMS) |
| 2145 |
As with Win32, \f(CW\*(C`system(1, @args)\*(C'\fR spawns an external process and |
| 2146 |
immediately returns its process designator without waiting for the |
| 2147 |
process to terminate. In this case the return value may be used subsequently |
| 2148 |
in \f(CW\*(C`wait\*(C'\fR or \f(CW\*(C`waitpid\*(C'\fR. |
| 2149 |
Otherwise the return value is POSIX-like (shifted up by 8 bits), which only |
| 2150 |
allows room for a made-up value derived from the severity bits of the native |
| 2151 |
32\-bit condition code (unless overridden by |
| 2152 |
\&\f(CW\*(C`use vmsish \*(Aqstatus\*(Aq\*(C'\fR). If the native |
| 2153 |
condition code is one that has a POSIX value encoded, the POSIX value will |
| 2154 |
be decoded to extract the expected exit value. For more details see |
| 2155 |
"$?" in perlvms. |
| 2156 |
.IP telldir 8 |
| 2157 |
.IX Item "telldir" |
| 2158 |
(Android) |
| 2159 |
Not implemented. |
| 2160 |
.IP times 8 |
| 2161 |
.IX Item "times" |
| 2162 |
(Win32) |
| 2163 |
"Cumulative" times will be bogus. On anything other than Windows NT |
| 2164 |
or Windows 2000, "system" time will be bogus, and "user" time is |
| 2165 |
actually the time returned by the \f(CWclock()\fR function in the C |
| 2166 |
runtime library. |
| 2167 |
.Sp |
| 2168 |
(RISC\ OS) |
| 2169 |
Not useful. |
| 2170 |
.IP truncate 8 |
| 2171 |
.IX Item "truncate" |
| 2172 |
(Older versions of VMS) |
| 2173 |
Not implemented. |
| 2174 |
.Sp |
| 2175 |
(VOS) |
| 2176 |
Truncation to same-or-shorter lengths only. |
| 2177 |
.Sp |
| 2178 |
(Win32) |
| 2179 |
If a FILEHANDLE is supplied, it must be writable and opened in append |
| 2180 |
mode (i.e., use \f(CW\*(C`open(my $fh, \*(Aq>>\*(Aq, \*(Aqfilename\*(Aq)\*(C'\fR |
| 2181 |
or \f(CW\*(C`sysopen(my $fh, ..., O_APPEND|O_RDWR)\*(C'\fR. If a filename is supplied, it |
| 2182 |
should not be held open elsewhere. |
| 2183 |
.IP umask 8 |
| 2184 |
.IX Item "umask" |
| 2185 |
Returns \f(CW\*(C`undef\*(C'\fR where unavailable. |
| 2186 |
.Sp |
| 2187 |
(AmigaOS) |
| 2188 |
\&\f(CW\*(C`umask\*(C'\fR works but the correct permissions are set only when the file |
| 2189 |
is finally closed. |
| 2190 |
.IP utime 8 |
| 2191 |
.IX Item "utime" |
| 2192 |
(VMS, RISC\ OS) |
| 2193 |
Only the modification time is updated. |
| 2194 |
.Sp |
| 2195 |
(Win32) |
| 2196 |
May not behave as expected. Behavior depends on the C runtime |
| 2197 |
library's implementation of \f(CWutime()\fR, and the filesystem |
| 2198 |
being used. The FAT filesystem typically does not support an "access |
| 2199 |
time" field, and it may limit timestamps to a granularity of two seconds. |
| 2200 |
.IP wait 8 |
| 2201 |
.IX Item "wait" |
| 2202 |
.PD 0 |
| 2203 |
.IP waitpid 8 |
| 2204 |
.IX Item "waitpid" |
| 2205 |
.PD |
| 2206 |
(Win32) |
| 2207 |
Can only be applied to process handles returned for processes spawned |
| 2208 |
using \f(CW\*(C`system(1, ...)\*(C'\fR or pseudo processes created with |
| 2209 |
\&\f(CW\*(C`fork\*(C'\fR. |
| 2210 |
.Sp |
| 2211 |
(RISC\ OS) |
| 2212 |
Not useful. |
| 2213 |
.SH "Supported Platforms" |
| 2214 |
.IX Header "Supported Platforms" |
| 2215 |
The following platforms are known to build Perl 5.12 (as of April 2010, |
| 2216 |
its release date) from the standard source code distribution available |
| 2217 |
at <http://www.cpan.org/src> |
| 2218 |
.IP "Linux (x86, ARM, IA64)" 4 |
| 2219 |
.IX Item "Linux (x86, ARM, IA64)" |
| 2220 |
.PD 0 |
| 2221 |
.IP HP-UX 4 |
| 2222 |
.IX Item "HP-UX" |
| 2223 |
.IP AIX 4 |
| 2224 |
.IX Item "AIX" |
| 2225 |
.IP Win32 4 |
| 2226 |
.IX Item "Win32" |
| 2227 |
.RS 4 |
| 2228 |
.IP "Windows 2000" 4 |
| 2229 |
.IX Item "Windows 2000" |
| 2230 |
.IP "Windows XP" 4 |
| 2231 |
.IX Item "Windows XP" |
| 2232 |
.IP "Windows Server 2003" 4 |
| 2233 |
.IX Item "Windows Server 2003" |
| 2234 |
.IP "Windows Vista" 4 |
| 2235 |
.IX Item "Windows Vista" |
| 2236 |
.IP "Windows Server 2008" 4 |
| 2237 |
.IX Item "Windows Server 2008" |
| 2238 |
.IP "Windows 7" 4 |
| 2239 |
.IX Item "Windows 7" |
| 2240 |
.RE |
| 2241 |
.RS 4 |
| 2242 |
.RE |
| 2243 |
.IP Cygwin 4 |
| 2244 |
.IX Item "Cygwin" |
| 2245 |
.PD |
| 2246 |
Some tests are known to fail: |
| 2247 |
.RS 4 |
| 2248 |
.IP \(bu 4 |
| 2249 |
\&\fIext/XS\-APItest/t/call_checker.t\fR \- see |
| 2250 |
<https://github.com/Perl/perl5/issues/10750> |
| 2251 |
.IP \(bu 4 |
| 2252 |
\&\fIdist/I18N\-Collate/t/I18N\-Collate.t\fR |
| 2253 |
.IP \(bu 4 |
| 2254 |
\&\fIext/Win32CORE/t/win32core.t\fR \- may fail on recent cygwin installs. |
| 2255 |
.RE |
| 2256 |
.RS 4 |
| 2257 |
.RE |
| 2258 |
.IP "Solaris (x86, SPARC)" 4 |
| 2259 |
.IX Item "Solaris (x86, SPARC)" |
| 2260 |
.PD 0 |
| 2261 |
.IP OpenVMS 4 |
| 2262 |
.IX Item "OpenVMS" |
| 2263 |
.RS 4 |
| 2264 |
.IP "Alpha (7.2 and later)" 4 |
| 2265 |
.IX Item "Alpha (7.2 and later)" |
| 2266 |
.IP "I64 (8.2 and later)" 4 |
| 2267 |
.IX Item "I64 (8.2 and later)" |
| 2268 |
.RE |
| 2269 |
.RS 4 |
| 2270 |
.RE |
| 2271 |
.IP NetBSD 4 |
| 2272 |
.IX Item "NetBSD" |
| 2273 |
.IP FreeBSD 4 |
| 2274 |
.IX Item "FreeBSD" |
| 2275 |
.IP "Debian GNU/kFreeBSD" 4 |
| 2276 |
.IX Item "Debian GNU/kFreeBSD" |
| 2277 |
.IP Haiku 4 |
| 2278 |
.IX Item "Haiku" |
| 2279 |
.IP "Irix (6.5. What else?)" 4 |
| 2280 |
.IX Item "Irix (6.5. What else?)" |
| 2281 |
.IP OpenBSD 4 |
| 2282 |
.IX Item "OpenBSD" |
| 2283 |
.IP "Dragonfly BSD" 4 |
| 2284 |
.IX Item "Dragonfly BSD" |
| 2285 |
.IP "Midnight BSD" 4 |
| 2286 |
.IX Item "Midnight BSD" |
| 2287 |
.IP "QNX Neutrino RTOS (6.5.0)" 4 |
| 2288 |
.IX Item "QNX Neutrino RTOS (6.5.0)" |
| 2289 |
.IP "MirOS BSD" 4 |
| 2290 |
.IX Item "MirOS BSD" |
| 2291 |
.IP "Stratus OpenVOS (17.0 or later)" 4 |
| 2292 |
.IX Item "Stratus OpenVOS (17.0 or later)" |
| 2293 |
.PD |
| 2294 |
Caveats: |
| 2295 |
.RS 4 |
| 2296 |
.IP "time_t issues that may or may not be fixed" 4 |
| 2297 |
.IX Item "time_t issues that may or may not be fixed" |
| 2298 |
.RE |
| 2299 |
.RS 4 |
| 2300 |
.RE |
| 2301 |
.PD 0 |
| 2302 |
.IP "Stratus VOS / OpenVOS" 4 |
| 2303 |
.IX Item "Stratus VOS / OpenVOS" |
| 2304 |
.IP AIX 4 |
| 2305 |
.IX Item "AIX" |
| 2306 |
.IP Android 4 |
| 2307 |
.IX Item "Android" |
| 2308 |
.IP FreeMINT 4 |
| 2309 |
.IX Item "FreeMINT" |
| 2310 |
.PD |
| 2311 |
Perl now builds with FreeMiNT/Atari. It fails a few tests, that needs |
| 2312 |
some investigation. |
| 2313 |
.Sp |
| 2314 |
The FreeMiNT port uses GNU dld for loadable module capabilities. So |
| 2315 |
ensure you have that library installed when building perl. |
| 2316 |
.SH "EOL Platforms" |
| 2317 |
.IX Header "EOL Platforms" |
| 2318 |
.SS "(Perl 5.37.1)" |
| 2319 |
.IX Subsection "(Perl 5.37.1)" |
| 2320 |
The following platforms were supported by a previous version of |
| 2321 |
Perl but have been officially removed from Perl's source code |
| 2322 |
as of 5.37.1: |
| 2323 |
.IP Ultrix 4 |
| 2324 |
.IX Item "Ultrix" |
| 2325 |
.SS "(Perl 5.36)" |
| 2326 |
.IX Subsection "(Perl 5.36)" |
| 2327 |
The following platforms were supported by a previous version of |
| 2328 |
Perl but have been officially removed from Perl's source code |
| 2329 |
as of 5.36: |
| 2330 |
.IP NetWare 4 |
| 2331 |
.IX Item "NetWare" |
| 2332 |
.PD 0 |
| 2333 |
.IP DOS/DJGPP 4 |
| 2334 |
.IX Item "DOS/DJGPP" |
| 2335 |
.IP "AT&T UWIN" 4 |
| 2336 |
.IX Item "AT&T UWIN" |
| 2337 |
.PD |
| 2338 |
.SS "(Perl 5.20)" |
| 2339 |
.IX Subsection "(Perl 5.20)" |
| 2340 |
The following platforms were supported by a previous version of |
| 2341 |
Perl but have been officially removed from Perl's source code |
| 2342 |
as of 5.20: |
| 2343 |
.IP "AT&T 3b1" 4 |
| 2344 |
.IX Item "AT&T 3b1" |
| 2345 |
.SS "(Perl 5.14)" |
| 2346 |
.IX Subsection "(Perl 5.14)" |
| 2347 |
The following platforms were supported up to 5.10. They may still |
| 2348 |
have worked in 5.12, but supporting code has been removed for 5.14: |
| 2349 |
.IP "Windows 95" 4 |
| 2350 |
.IX Item "Windows 95" |
| 2351 |
.PD 0 |
| 2352 |
.IP "Windows 98" 4 |
| 2353 |
.IX Item "Windows 98" |
| 2354 |
.IP "Windows ME" 4 |
| 2355 |
.IX Item "Windows ME" |
| 2356 |
.IP "Windows NT4" 4 |
| 2357 |
.IX Item "Windows NT4" |
| 2358 |
.PD |
| 2359 |
.SS "(Perl 5.12)" |
| 2360 |
.IX Subsection "(Perl 5.12)" |
| 2361 |
The following platforms were supported by a previous version of |
| 2362 |
Perl but have been officially removed from Perl's source code |
| 2363 |
as of 5.12: |
| 2364 |
.IP "Atari MiNT" 4 |
| 2365 |
.IX Item "Atari MiNT" |
| 2366 |
.PD 0 |
| 2367 |
.IP "Apollo Domain/OS" 4 |
| 2368 |
.IX Item "Apollo Domain/OS" |
| 2369 |
.IP "Apple Mac OS 8/9" 4 |
| 2370 |
.IX Item "Apple Mac OS 8/9" |
| 2371 |
.IP "Tenon Machten" 4 |
| 2372 |
.IX Item "Tenon Machten" |
| 2373 |
.PD |
| 2374 |
.SH "Supported Platforms (Perl 5.8)" |
| 2375 |
.IX Header "Supported Platforms (Perl 5.8)" |
| 2376 |
As of July 2002 (the Perl release 5.8.0), the following platforms were |
| 2377 |
able to build Perl from the standard source code distribution |
| 2378 |
available at <http://www.cpan.org/src/> |
| 2379 |
.PP |
| 2380 |
.Vb 10 |
| 2381 |
\& AIX |
| 2382 |
\& BeOS |
| 2383 |
\& BSD/OS (BSDi) |
| 2384 |
\& Cygwin |
| 2385 |
\& DG/UX |
| 2386 |
\& DOS DJGPP 1) |
| 2387 |
\& DYNIX/ptx |
| 2388 |
\& EPOC R5 |
| 2389 |
\& FreeBSD |
| 2390 |
\& HI\-UXMPP (Hitachi) (5.8.0 worked but we didn\*(Aqt know it) |
| 2391 |
\& HP\-UX |
| 2392 |
\& IRIX |
| 2393 |
\& Linux |
| 2394 |
\& Mac OS Classic |
| 2395 |
\& Mac OS X (Darwin) |
| 2396 |
\& MPE/iX |
| 2397 |
\& NetBSD |
| 2398 |
\& NetWare |
| 2399 |
\& NonStop\-UX |
| 2400 |
\& ReliantUNIX (formerly SINIX) |
| 2401 |
\& OpenBSD |
| 2402 |
\& OpenVMS (formerly VMS) |
| 2403 |
\& Open UNIX (Unixware) (since Perl 5.8.1/5.9.0) |
| 2404 |
\& OS/2 |
| 2405 |
\& OS/400 (using the PASE) (since Perl 5.8.1/5.9.0) |
| 2406 |
\& POSIX\-BC (formerly BS2000) |
| 2407 |
\& QNX |
| 2408 |
\& Solaris |
| 2409 |
\& SunOS 4 |
| 2410 |
\& SUPER\-UX (NEC) |
| 2411 |
\& Tru64 UNIX (formerly DEC OSF/1, Digital UNIX) |
| 2412 |
\& UNICOS |
| 2413 |
\& UNICOS/mk |
| 2414 |
\& UTS |
| 2415 |
\& VOS / OpenVOS |
| 2416 |
\& Win95/98/ME/2K/XP 2) |
| 2417 |
\& WinCE |
| 2418 |
\& z/OS (formerly OS/390) |
| 2419 |
\& VM/ESA |
| 2420 |
\& |
| 2421 |
\& 1) in DOS mode either the DOS or OS/2 ports can be used |
| 2422 |
\& 2) compilers: Borland, MinGW (GCC), VC6 |
| 2423 |
.Ve |
| 2424 |
.PP |
| 2425 |
The following platforms worked with the previous releases (5.6 and |
| 2426 |
5.7), but we did not manage either to fix or to test these in time |
| 2427 |
for the 5.8.0 release. There is a very good chance that many of these |
| 2428 |
will work fine with the 5.8.0. |
| 2429 |
.PP |
| 2430 |
.Vb 10 |
| 2431 |
\& BSD/OS |
| 2432 |
\& DomainOS |
| 2433 |
\& Hurd |
| 2434 |
\& LynxOS |
| 2435 |
\& MachTen |
| 2436 |
\& PowerMAX |
| 2437 |
\& SCO SV |
| 2438 |
\& SVR4 |
| 2439 |
\& Unixware |
| 2440 |
\& Windows 3.1 |
| 2441 |
.Ve |
| 2442 |
.PP |
| 2443 |
Known to be broken for 5.8.0 (but 5.6.1 and 5.7.2 can be used): |
| 2444 |
.PP |
| 2445 |
.Vb 1 |
| 2446 |
\& AmigaOS 3 |
| 2447 |
.Ve |
| 2448 |
.PP |
| 2449 |
The following platforms have been known to build Perl from source in |
| 2450 |
the past (5.005_03 and earlier), but we haven't been able to verify |
| 2451 |
their status for the current release, either because the |
| 2452 |
hardware/software platforms are rare or because we don't have an |
| 2453 |
active champion on these platforms\-\-or both. They used to work, |
| 2454 |
though, so go ahead and try compiling them, and let |
| 2455 |
<https://github.com/Perl/perl5/issues> know |
| 2456 |
of any trouble. |
| 2457 |
.PP |
| 2458 |
.Vb 10 |
| 2459 |
\& 3b1 |
| 2460 |
\& A/UX |
| 2461 |
\& ConvexOS |
| 2462 |
\& CX/UX |
| 2463 |
\& DC/OSx |
| 2464 |
\& DDE SMES |
| 2465 |
\& DOS EMX |
| 2466 |
\& Dynix |
| 2467 |
\& EP/IX |
| 2468 |
\& ESIX |
| 2469 |
\& FPS |
| 2470 |
\& GENIX |
| 2471 |
\& Greenhills |
| 2472 |
\& ISC |
| 2473 |
\& MachTen 68k |
| 2474 |
\& MPC |
| 2475 |
\& NEWS\-OS |
| 2476 |
\& NextSTEP |
| 2477 |
\& OpenSTEP |
| 2478 |
\& Opus |
| 2479 |
\& Plan 9 |
| 2480 |
\& RISC/os |
| 2481 |
\& SCO ODT/OSR |
| 2482 |
\& Stellar |
| 2483 |
\& SVR2 |
| 2484 |
\& TI1500 |
| 2485 |
\& TitanOS |
| 2486 |
\& Unisys Dynix |
| 2487 |
.Ve |
| 2488 |
.PP |
| 2489 |
The following platforms have their own source code distributions and |
| 2490 |
binaries available via <http://www.cpan.org/ports/> |
| 2491 |
.PP |
| 2492 |
.Vb 1 |
| 2493 |
\& Perl release |
| 2494 |
\& |
| 2495 |
\& OS/400 (ILE) 5.005_02 |
| 2496 |
\& Tandem Guardian 5.004 |
| 2497 |
.Ve |
| 2498 |
.PP |
| 2499 |
The following platforms have only binaries available via |
| 2500 |
<http://www.cpan.org/ports/index.html> : |
| 2501 |
.PP |
| 2502 |
.Vb 1 |
| 2503 |
\& Perl release |
| 2504 |
\& |
| 2505 |
\& Acorn RISCOS 5.005_02 |
| 2506 |
\& AOS 5.002 |
| 2507 |
\& LynxOS 5.004_02 |
| 2508 |
.Ve |
| 2509 |
.PP |
| 2510 |
Although we do suggest that you always build your own Perl from |
| 2511 |
the source code, both for maximal configurability and for security, |
| 2512 |
in case you are in a hurry you can check |
| 2513 |
<http://www.cpan.org/ports/index.html> for binary distributions. |
| 2514 |
.SH "SEE ALSO" |
| 2515 |
.IX Header "SEE ALSO" |
| 2516 |
perlaix, perlamiga, perlbs2000, |
| 2517 |
perlcygwin, |
| 2518 |
perlebcdic, perlfreebsd, perlhurd, perlhpux, perlirix, |
| 2519 |
perlmacosx, |
| 2520 |
perlos2, perlos390, perlos400, |
| 2521 |
perlplan9, perlqnx, perlsolaris, perltru64, |
| 2522 |
perlunicode, perlvms, perlvos, perlwin32, and Win32. |
| 2523 |
.SH "AUTHORS / CONTRIBUTORS" |
| 2524 |
.IX Header "AUTHORS / CONTRIBUTORS" |
| 2525 |
Abigail <[email protected]>, |
| 2526 |
Charles Bailey <[email protected]>, |
| 2527 |
Graham Barr <[email protected]>, |
| 2528 |
Tom Christiansen <[email protected]>, |
| 2529 |
Nicholas Clark <[email protected]>, |
| 2530 |
Thomas Dorner <[email protected]>, |
| 2531 |
Andy Dougherty <[email protected]>, |
| 2532 |
Dominic Dunlop <[email protected]>, |
| 2533 |
Neale Ferguson <[email protected]>, |
| 2534 |
David J. Fiander <[email protected]>, |
| 2535 |
Paul Green <[email protected]>, |
| 2536 |
M.J.T. Guy <[email protected]>, |
| 2537 |
Jarkko Hietaniemi <[email protected]>, |
| 2538 |
Luther Huffman <[email protected]>, |
| 2539 |
Nick Ing-Simmons <nick@ing\-simmons.net>, |
| 2540 |
Andreas J. König <[email protected]>, |
| 2541 |
Markus Laker <[email protected]>, |
| 2542 |
Andrew M. Langmead <[email protected]>, |
| 2543 |
Lukas Mai <[email protected]>, |
| 2544 |
Larry Moore <[email protected]>, |
| 2545 |
Paul Moore <[email protected]\-it.com>, |
| 2546 |
Chris Nandor <[email protected]>, |
| 2547 |
Matthias Neeracher <[email protected]>, |
| 2548 |
Philip Newton <[email protected]>, |
| 2549 |
Gary Ng <[email protected]>, |
| 2550 |
Tom Phoenix <[email protected]>, |
| 2551 |
André Pirard <[email protected]>, |
| 2552 |
Peter Prymmer <[email protected]>, |
| 2553 |
Hugo van der Sanden <[email protected]>, |
| 2554 |
Gurusamy Sarathy <[email protected]>, |
| 2555 |
Paul J. Schinder <[email protected]>, |
| 2556 |
Michael G Schwern <[email protected]>, |
| 2557 |
Dan Sugalski <[email protected]>, |
| 2558 |
Nathan Torkington <[email protected]>, |
| 2559 |
John Malmberg <[email protected]> |