CINXE.COM
perlport - Writing portable Perl - Perldoc Browser
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>perlport - Writing portable Perl - Perldoc Browser</title> <link rel="search" href="/opensearch.xml" type="application/opensearchdescription+xml" title="Perldoc Browser"> <link rel="canonical" href="https://perldoc.perl.org/perlport"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/stackoverflow-light.min.css" integrity="sha512-cG1IdFxqipi3gqLmksLtuk13C+hBa57a6zpWxMeoY3Q9O6ooFxq50DayCdm0QrDgZjMUn23z/0PMZlgft7Yp5Q==" crossorigin="anonymous" /> <style> body { background: #f4f4f5; color: #020202; } .navbar-dark { background-image: -webkit-linear-gradient(top, #005f85 0, #002e49 100%); background-image: -o-linear-gradient(top, #005f85 0, #002e49 100%); background-image: linear-gradient(to bottom, #005f85 0, #002e49 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff005f85', endColorstr='#ff002e49', GradientType=0); background-repeat: repeat-x; } .navbar-dark .navbar-nav .nav-link, .navbar-dark .navbar-nav .nav-link:focus { color: #fff } .navbar-dark .navbar-nav .nav-link:hover { color: #ffef68 } #wrapperlicious { margin: 0 auto; font: 0.9em 'Helvetica Neue', Helvetica, sans-serif; font-weight: normal; line-height: 1.5em; margin: 0; padding: 0; } #wrapperlicious h1 { font-size: 1.5em } #wrapperlicious h2 { font-size: 1.3em } #wrapperlicious h3 { font-size: 1.1em } #wrapperlicious h4 { font-size: 0.9em } #wrapperlicious h1, #wrapperlicious h2, #wrapperlicious h3, #wrapperlicious h4, #wrapperlicious dt { color: #020202; margin-top: 1em; margin-bottom: 1em; position: relative; font-weight: bold; } #wrapperlicious a { color: inherit; text-decoration: underline } #wrapperlicious #toc { text-decoration: none } #wrapperlicious a:hover { color: #2a2a2a } #wrapperlicious a img { border: 0 } #wrapperlicious :not(pre) > code { color: inherit; background-color: rgba(0, 0, 0, 0.04); border-radius: 3px; font: 0.9em Consolas, Menlo, Monaco, monospace; padding: 0.3em; } #wrapperlicious dd { margin: 0; margin-left: 2em; } #wrapperlicious dt { color: #2a2a2a; font-weight: bold; margin-left: 0.9em; } #wrapperlicious p { margin-bottom: 1em; margin-top: 1em; } #wrapperlicious li > p { margin-bottom: 0; margin-top: 0; } #wrapperlicious pre { border: 1px solid #c1c1c1; border-radius: 3px; font: 100% Consolas, Menlo, Monaco, monospace; margin-bottom: 1em; margin-top: 1em; } #wrapperlicious pre > code { display: block; background-color: #f6f6f6; font: 0.9em Consolas, Menlo, Monaco, monospace; line-height: 1.5em; text-align: left; white-space: pre; padding: 1em; } #wrapperlicious dl, #wrapperlicious ol, #wrapperlicious ul { margin-bottom: 1em; margin-top: 1em; } #wrapperlicious ul { list-style-type: square; } #wrapperlicious ul ul { margin-bottom: 0px; margin-top: 0px; } #footer { font-size: 0.8em; padding-top: 0.5em; text-align: center; } #more { display: inline; font-size: 0.8em; } #perldocdiv { background-color: #fff; border: 1px solid #c1c1c1; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; margin-left: auto; margin-right: auto; padding: 3em; padding-top: 1em; max-width: 960px; } #moduleversion { float: right } #wrapperlicious .leading-notice { font-style: italic; padding-left: 1em; margin-top: 1em; margin-bottom: 1em; } #wrapperlicious .permalink { display: none; left: -0.75em; position: absolute; padding-right: 0.25em; text-decoration: none; } #wrapperlicious h1:hover .permalink, #wrapperlicious h2:hover .permalink, #wrapperlicious h3:hover .permalink, #wrapperlicious h4:hover .permalink, #wrapperlicious dt:hover .permalink { display: block; } </style> <!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-KVNWBNT5FB"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-KVNWBNT5FB'); gtag('config', 'UA-50555-3'); </script> </head> <body> <nav class="navbar navbar-expand-md navbar-dark bg-dark justify-content-between"> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <a class="navbar-brand" href="/"><img src="/images/perl_camel_30.png" width="30" height="30" class="d-inline-block align-top" alt="Perl Camel Logo"> Perldoc Browser</a> <div class="collapse navbar-collapse" id="navbarNav"> <ul class="navbar-nav mr-auto"> <li class="nav-item dropdown text-nowrap"> <a class="nav-link dropdown-toggle" href="#" id="dropdownlink-stable" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">5.005_01</a> <div class="dropdown-menu" aria-labelledby="dropdownlink-stable"> <a class="dropdown-item" href="/perlport">Latest</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.40.1/perlport">5.40.1</a> <a class="dropdown-item" href="/5.40.0/perlport">5.40.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.38.3/perlport">5.38.3</a> <a class="dropdown-item" href="/5.38.2/perlport">5.38.2</a> <a class="dropdown-item" href="/5.38.1/perlport">5.38.1</a> <a class="dropdown-item" href="/5.38.0/perlport">5.38.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.36.3/perlport">5.36.3</a> <a class="dropdown-item" href="/5.36.2/perlport">5.36.2</a> <a class="dropdown-item" href="/5.36.1/perlport">5.36.1</a> <a class="dropdown-item" href="/5.36.0/perlport">5.36.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.34.3/perlport">5.34.3</a> <a class="dropdown-item" href="/5.34.2/perlport">5.34.2</a> <a class="dropdown-item" href="/5.34.1/perlport">5.34.1</a> <a class="dropdown-item" href="/5.34.0/perlport">5.34.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.32.1/perlport">5.32.1</a> <a class="dropdown-item" href="/5.32.0/perlport">5.32.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.30.3/perlport">5.30.3</a> <a class="dropdown-item" href="/5.30.2/perlport">5.30.2</a> <a class="dropdown-item" href="/5.30.1/perlport">5.30.1</a> <a class="dropdown-item" href="/5.30.0/perlport">5.30.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.28.3/perlport">5.28.3</a> <a class="dropdown-item" href="/5.28.2/perlport">5.28.2</a> <a class="dropdown-item" href="/5.28.1/perlport">5.28.1</a> <a class="dropdown-item" href="/5.28.0/perlport">5.28.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.26.3/perlport">5.26.3</a> <a class="dropdown-item" href="/5.26.2/perlport">5.26.2</a> <a class="dropdown-item" href="/5.26.1/perlport">5.26.1</a> <a class="dropdown-item" href="/5.26.0/perlport">5.26.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.24.4/perlport">5.24.4</a> <a class="dropdown-item" href="/5.24.3/perlport">5.24.3</a> <a class="dropdown-item" href="/5.24.2/perlport">5.24.2</a> <a class="dropdown-item" href="/5.24.1/perlport">5.24.1</a> <a class="dropdown-item" href="/5.24.0/perlport">5.24.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.22.4/perlport">5.22.4</a> <a class="dropdown-item" href="/5.22.3/perlport">5.22.3</a> <a class="dropdown-item" href="/5.22.2/perlport">5.22.2</a> <a class="dropdown-item" href="/5.22.1/perlport">5.22.1</a> <a class="dropdown-item" href="/5.22.0/perlport">5.22.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.20.3/perlport">5.20.3</a> <a class="dropdown-item" href="/5.20.2/perlport">5.20.2</a> <a class="dropdown-item" href="/5.20.1/perlport">5.20.1</a> <a class="dropdown-item" href="/5.20.0/perlport">5.20.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.18.4/perlport">5.18.4</a> <a class="dropdown-item" href="/5.18.3/perlport">5.18.3</a> <a class="dropdown-item" href="/5.18.2/perlport">5.18.2</a> <a class="dropdown-item" href="/5.18.1/perlport">5.18.1</a> <a class="dropdown-item" href="/5.18.0/perlport">5.18.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.16.3/perlport">5.16.3</a> <a class="dropdown-item" href="/5.16.2/perlport">5.16.2</a> <a class="dropdown-item" href="/5.16.1/perlport">5.16.1</a> <a class="dropdown-item" href="/5.16.0/perlport">5.16.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.14.4/perlport">5.14.4</a> <a class="dropdown-item" href="/5.14.3/perlport">5.14.3</a> <a class="dropdown-item" href="/5.14.2/perlport">5.14.2</a> <a class="dropdown-item" href="/5.14.1/perlport">5.14.1</a> <a class="dropdown-item" href="/5.14.0/perlport">5.14.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.12.5/perlport">5.12.5</a> <a class="dropdown-item" href="/5.12.4/perlport">5.12.4</a> <a class="dropdown-item" href="/5.12.3/perlport">5.12.3</a> <a class="dropdown-item" href="/5.12.2/perlport">5.12.2</a> <a class="dropdown-item" href="/5.12.1/perlport">5.12.1</a> <a class="dropdown-item" href="/5.12.0/perlport">5.12.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.10.1/perlport">5.10.1</a> <a class="dropdown-item" href="/5.10.0/perlport">5.10.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.8.9/perlport">5.8.9</a> <a class="dropdown-item" href="/5.8.8/perlport">5.8.8</a> <a class="dropdown-item" href="/5.8.7/perlport">5.8.7</a> <a class="dropdown-item" href="/5.8.6/perlport">5.8.6</a> <a class="dropdown-item" href="/5.8.5/perlport">5.8.5</a> <a class="dropdown-item" href="/5.8.4/perlport">5.8.4</a> <a class="dropdown-item" href="/5.8.3/perlport">5.8.3</a> <a class="dropdown-item" href="/5.8.2/perlport">5.8.2</a> <a class="dropdown-item" href="/5.8.1/perlport">5.8.1</a> <a class="dropdown-item" href="/5.8.0/perlport">5.8.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.6.2/perlport">5.6.2</a> <a class="dropdown-item" href="/5.6.1/perlport">5.6.1</a> <a class="dropdown-item" href="/5.6.0/perlport">5.6.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.005_04/perlport">5.005_04</a> <a class="dropdown-item" href="/5.005_03/perlport">5.005_03</a> <a class="dropdown-item" href="/5.005_02/perlport">5.005_02</a> <a class="dropdown-item active" href="/5.005_01/perlport">5.005_01</a> <a class="dropdown-item" href="/5.005/perlport">5.005</a> </div> </li> <li class="nav-item dropdown text-nowrap"> <a class="nav-link dropdown-toggle" href="#" id="dropdownlink-dev" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dev</a> <div class="dropdown-menu" aria-labelledby="dropdownlink-dev"> <a class="dropdown-item" href="/blead/perlport">blead</a> <a class="dropdown-item" href="/5.41.9/perlport">5.41.9</a> <a class="dropdown-item" href="/5.41.8/perlport">5.41.8</a> <a class="dropdown-item" href="/5.41.7/perlport">5.41.7</a> <a class="dropdown-item" href="/5.41.6/perlport">5.41.6</a> <a class="dropdown-item" href="/5.41.5/perlport">5.41.5</a> <a class="dropdown-item" href="/5.41.4/perlport">5.41.4</a> <a class="dropdown-item" href="/5.41.3/perlport">5.41.3</a> <a class="dropdown-item" href="/5.41.2/perlport">5.41.2</a> <a class="dropdown-item" href="/5.41.1/perlport">5.41.1</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.40.1-RC1/perlport">5.40.1-RC1</a> <a class="dropdown-item" href="/5.40.0-RC2/perlport">5.40.0-RC2</a> <a class="dropdown-item" href="/5.40.0-RC1/perlport">5.40.0-RC1</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.39.10/perlport">5.39.10</a> <a class="dropdown-item" href="/5.39.9/perlport">5.39.9</a> <a class="dropdown-item" href="/5.39.8/perlport">5.39.8</a> <a class="dropdown-item" href="/5.39.7/perlport">5.39.7</a> <a class="dropdown-item" href="/5.39.6/perlport">5.39.6</a> <a class="dropdown-item" href="/5.39.5/perlport">5.39.5</a> <a class="dropdown-item" href="/5.39.4/perlport">5.39.4</a> <a class="dropdown-item" href="/5.39.3/perlport">5.39.3</a> <a class="dropdown-item" href="/5.39.2/perlport">5.39.2</a> <a class="dropdown-item" href="/5.39.1/perlport">5.39.1</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.38.3-RC1/perlport">5.38.3-RC1</a> </div> </li> <li class="nav-item dropdown text-nowrap"> <a class="nav-link dropdown-toggle" href="#" id="dropdownlink-nav" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Documentation</a> <div class="dropdown-menu" aria-labelledby="dropdownlink-nav"> <a class="dropdown-item" href="/5.005_01/perl">Perl</a> <a class="dropdown-item" href="/5.005_01/perlintro">Intro</a> <a class="dropdown-item" href="/5.005_01/perl#Tutorials">Tutorials</a> <a class="dropdown-item" href="/5.005_01/perlfaq">FAQs</a> <a class="dropdown-item" href="/5.005_01/perl#Reference-Manual">Reference</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.005_01/perlop">Operators</a> <a class="dropdown-item" href="/5.005_01/functions">Functions</a> <a class="dropdown-item" href="/5.005_01/variables">Variables</a> <a class="dropdown-item" href="/5.005_01/modules">Modules</a> <a class="dropdown-item" href="/5.005_01/perlutil">Utilities</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.005_01/perldelta">Release Notes</a> <a class="dropdown-item" href="/5.005_01/perlcommunity">Community</a> <a class="dropdown-item" href="/5.005_01/perlhist">History</a> </div> </li> </ul> <ul class="navbar-nav"> <script> function set_expand (expand) { var perldocdiv = document.getElementById('perldocdiv'); var width = window.getComputedStyle(perldocdiv).getPropertyValue('max-width'); var expanded = (width == '' || width == 'none') ? true : false; if (expand === null) { expand = !expanded; } if ((expand && !expanded) || (!expand && expanded)) { perldocdiv.style.setProperty('max-width', expand ? 'none' : '960px'); var button_classlist = document.getElementById('content-expand-button').classList; if (expand) { button_classlist.add('btn-light'); button_classlist.remove('btn-outline-light'); } else { button_classlist.add('btn-outline-light'); button_classlist.remove('btn-light'); } } return expand; } function toggle_expand () { var expand = set_expand(null); document.cookie = 'perldoc_expand=' + (expand ? 1 : 0) + '; path=/; expires=Tue, 19 Jan 2038 03:14:07 UTC'; } function read_expand () { return document.cookie.split(';').some(function (item) { return item.indexOf('perldoc_expand=1') >= 0 }); } if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', function () { if (read_expand()) { set_expand(true); } }); } else if (read_expand()) { set_expand(true); } </script> <button id="content-expand-button" type="button" class="btn btn-outline-light d-none d-lg-inline-block mr-4" onclick="toggle_expand()">Expand</button> </ul> <form class="form-inline" method="get" action="/5.005_01/search"> <input class="form-control mr-3" type="search" name="q" placeholder="Search" aria-label="Search" value=""> </form> </div> </nav> <div id="wrapperlicious" class="container-fluid"> <div id="perldocdiv"> <div id="links"> <a href="/5.005_01/perlport">perlport</a> <div id="more"> (<a href="/5.005_01/perlport.txt">source</a>, <a href="https://metacpan.org/pod/perlport">CPAN</a>) </div> </div> <div class="leading-notice"> You are viewing the version of this documentation from Perl 5.005_01. <a href="/perlport">View the latest version</a> </div> <h1><a id="toc">CONTENTS</a></h1> <ul> <li> <a class="text-decoration-none" href="#NAME">NAME</a> </li> <li> <a class="text-decoration-none" href="#DESCRIPTION">DESCRIPTION</a> </li> <li> <a class="text-decoration-none" href="#ISSUES">ISSUES</a> <ul> <li> <a class="text-decoration-none" href="#Newlines">Newlines</a> </li> <li> <a class="text-decoration-none" href="#File-Paths">File Paths</a> </li> <li> <a class="text-decoration-none" href="#System-Interaction">System Interaction</a> </li> <li> <a class="text-decoration-none" href="#Interprocess-Communication-(IPC)">Interprocess Communication (IPC)</a> </li> <li> <a class="text-decoration-none" href="#External-Subroutines-(XS)">External Subroutines (XS)</a> </li> <li> <a class="text-decoration-none" href="#Standard-Modules">Standard Modules</a> </li> <li> <a class="text-decoration-none" href="#Time-and-Date">Time and Date</a> </li> <li> <a class="text-decoration-none" href="#System-Resources">System Resources</a> </li> <li> <a class="text-decoration-none" href="#Security">Security</a> </li> <li> <a class="text-decoration-none" href="#Style">Style</a> </li> </ul> </li> <li> <a class="text-decoration-none" href="#CPAN-TESTERS">CPAN TESTERS</a> </li> <li> <a class="text-decoration-none" href="#PLATFORMS">PLATFORMS</a> <ul> <li> <a class="text-decoration-none" href="#Unix">Unix</a> </li> <li> <a class="text-decoration-none" href="#DOS-and-Derivatives">DOS and Derivatives</a> </li> <li> <a class="text-decoration-none" href="#MacPerl">MacPerl</a> </li> <li> <a class="text-decoration-none" href="#VMS">VMS</a> </li> <li> <a class="text-decoration-none" href="#EBCDIC-Platforms">EBCDIC Platforms</a> </li> <li> <a class="text-decoration-none" href="#Other-perls">Other perls</a> </li> </ul> </li> <li> <a class="text-decoration-none" href="#FUNCTION-IMPLEMENTATIONS">FUNCTION IMPLEMENTATIONS</a> <ul> <li> <a class="text-decoration-none" href="#Alphabetical-Listing-of-Perl-Functions">Alphabetical Listing of Perl Functions</a> </li> </ul> </li> <li> <a class="text-decoration-none" href="#AUTHORS-/-CONTRIBUTORS">AUTHORS / CONTRIBUTORS</a> </li> <li> <a class="text-decoration-none" href="#VERSION">VERSION</a> </li> </ul> <h1 id="NAME"><a class="permalink" href="#NAME">#</a>NAME</h1> <p>perlport - Writing portable Perl</p> <h1 id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">#</a>DESCRIPTION</h1> <p>Perl runs on a variety of operating systems. While most of them share a lot in common, they also have their own very particular and unique features.</p> <p>This document is meant to help you to find out what constitutes portable perl code, so that once you have made your decision to write portably, you know where the lines are drawn, and you can stay within them.</p> <p>There is a tradeoff between taking full advantage of <b>a</b> particular type of computer, and taking advantage of a full <b>range</b> of them. Naturally, as you make your range bigger (and thus more diverse), the common denominators drop, and you are left with fewer areas of common ground in which you can operate to accomplish a particular task. Thus, when you begin attacking a problem, it is important to consider which part of the tradeoff curve you want to operate under. Specifically, whether it is important to you that the task that you are coding needs the full generality of being portable, or if it is sufficient to just get the job done. This is the hardest choice to be made. The rest is easy, because Perl provides lots of choices, whichever way you want to approach your problem.</p> <p>Looking at it another way, writing portable code is usually about willfully limiting your available choices. Naturally, it takes discipline to do that.</p> <p>Be aware of two important points:</p> <dl> <dt id="Not-all-Perl-programs-have-to-be-portable"><a class="permalink" href="#Not-all-Perl-programs-have-to-be-portable">#</a><a id="Not"></a>Not all Perl programs have to be portable</dt> <dd> <p>There is no reason why you should not use Perl as a language to glue Unix tools together, or to prototype a Macintosh application, or to manage the Windows registry. If it makes no sense to aim for portability for one reason or another in a given program, then don't bother.</p> </dd> <dt id="The-vast-majority-of-Perl-is-portable"><a class="permalink" href="#The-vast-majority-of-Perl-is-portable">#</a><a id="The"></a>The vast majority of Perl <b>is</b> portable</dt> <dd> <p>Don't be fooled into thinking that it is hard to create portable Perl code. It isn't. Perl tries its level-best to bridge the gaps between what's available on different platforms, and all the means available to use those features. Thus almost all Perl code runs on any machine without modification. But there <i>are</i> some significant issues in writing portable code, and this document is entirely about those issues.</p> </dd> </dl> <p>Here's the general rule: When you approach a task that is commonly done using a whole range of platforms, think in terms of writing portable code. That way, you don't sacrifice much by way of the implementation choices you can avail yourself of, and at the same time you can give your users lots of platform choices. On the other hand, when you have to take advantage of some unique feature of a particular platform, as is often the case with systems programming (whether for Unix, Windows, <span style="white-space: nowrap;">Mac OS</span>, VMS, etc.), consider writing platform-specific code.</p> <p>When the code will run on only two or three operating systems, then you may only need to consider the differences of those particular systems. The important thing is to decide where the code will run, and to be deliberate in your decision.</p> <p>This information should not be considered complete; it includes possibly transient information about idiosyncracies of some of the ports, almost all of which are in a state of constant evolution. Thus this material should be considered a perpetual work in progress (<IMG SRC="yellow_sign.gif" ALT="Under Construction">).</p> <h1 id="ISSUES"><a class="permalink" href="#ISSUES">#</a>ISSUES</h1> <h2 id="Newlines"><a class="permalink" href="#Newlines">#</a>Newlines</h2> <p>In most operating systems, lines in files are separated with newlines. Just what is used as a newline may vary from OS to OS. Unix traditionally uses <code>\012</code>, one kind of Windows I/O uses <code>\015\012</code>, and <span style="white-space: nowrap;">Mac OS</span> uses <code>\015</code>.</p> <p>Perl uses <code>\n</code> to represent the "logical" newline, where what is logical may depend on the platform in use. In MacPerl, <code>\n</code> always means <code>\015</code>. In DOSish perls, <code>\n</code> usually means <code>\012</code>, but when accessing a file in "text" mode, STDIO translates it to (or from) <code>\015\012</code>.</p> <p>Due to the "text" mode translation, DOSish perls have limitations of using <code>seek</code> and <code>tell</code> when a file is being accessed in "text" mode. Specifically, if you stick to <code>seek</code>-ing to locations you got from <code>tell</code> (and no others), you are usually free to use <code>seek</code> and <code>tell</code> even in "text" mode. In general, using <code>seek</code> or <code>tell</code> or other file operations that count bytes instead of characters, without considering the length of <code>\n</code>, may be non-portable. If you use <code>binmode</code> on a file, however, you can usually use <code>seek</code> and <code>tell</code> with arbitrary values quite safely.</p> <p>A common misconception in socket programming is that <code>\n</code> eq <code>\012</code> everywhere. When using protocols, such as common Internet protocols, <code>\012</code> and <code>\015</code> are called for specifically, and the values of the logical <code>\n</code> and <code>\r</code> (carriage return) are not reliable.</p> <pre><code>print SOCKET "Hi there, client!\r\n"; # WRONG print SOCKET "Hi there, client!\015\012"; # RIGHT</code></pre> <p>[NOTE: this does not necessarily apply to communications that are filtered by another program or module before sending to the socket; the the most popular EBCDIC webserver, for instance, accepts <code>\r\n</code>, which translates those characters, along with all other characters in text streams, from EBCDIC to ASCII.]</p> <p>However, <code>\015\012</code> (or <code>\cM\cJ</code>, or <code>\x0D\x0A</code>) can be tedious and unsightly, as well as confusing to those maintaining the code. As such, the <code>Socket</code> module supplies the Right Thing for those who want it.</p> <pre><code>use Socket qw(:DEFAULT :crlf); print SOCKET "Hi there, client!$CRLF" # RIGHT</code></pre> <p>When reading <i>from</i> a socket, remember that the default input record separator (<code>$/</code>) is <code>\n</code>, but code like this should recognize <code>$/</code> as <code>\012</code> or <code>\015\012</code>:</p> <pre><code>while (<SOCKET>) { # ... }</code></pre> <p>Better:</p> <pre><code>use Socket qw(:DEFAULT :crlf); local($/) = LF; # not needed if $/ is already \012 while (<SOCKET>) { s/$CR?$LF/\n/; # not sure if socket uses LF or CRLF, OK # s/\015?\012/\n/; # same thing }</code></pre> <p>And this example is actually better than the previous one even for Unix platforms, because now any <code>\015</code>'s (<code>\cM</code>'s) are stripped out (and there was much rejoicing).</p> <h2 id="File-Paths"><a class="permalink" href="#File-Paths">#</a><a id="File"></a>File Paths</h2> <p>Most platforms these days structure files in a hierarchical fashion. So, it is reasonably safe to assume that any platform supports the notion of a "path" to uniquely identify a file on the system. Just how that path is actually written, differs.</p> <p>While they are similar, file path specifications differ between Unix, Windows, <span style="white-space: nowrap;">Mac OS</span>, OS/2, VMS and probably others. Unix, for example, is one of the few OSes that has the idea of a root directory. <span style="white-space: nowrap;">Mac OS</span> uses <code>:</code> as a path separator instead of <code>/</code>. VMS, Windows, and OS/2 can work similarly to Unix with <code>/</code> as path separator, or in their own idiosyncratic ways.</p> <p>As with the newline problem above, there are modules that can help. The <code>File::Spec</code> modules provide methods to do the Right Thing on whatever platform happens to be running the program.</p> <pre><code>use File::Spec; chdir(File::Spec->updir()); # go up one directory $file = File::Spec->catfile( File::Spec->curdir(), 'temp', 'file.txt' ); # on Unix and Win32, './temp/file.txt' # on Mac OS, ':temp:file.txt'</code></pre> <p>File::Spec is available in the standard distribution, as of version 5.004_05.</p> <p>In general, production code should not have file paths hardcoded; making them user supplied or from a configuration file is better, keeping in mind that file path syntax varies on different machines.</p> <p>This is especially noticeable in scripts like Makefiles and test suites, which often assume <code>/</code> as a path separator for subdirectories.</p> <p>Also of use is <code>File::Basename</code>, from the standard distribution, which splits a pathname into pieces (base filename, full path to directory, and file suffix).</p> <p>Remember not to count on the existence of system-specific files, like <i>/etc/resolv.conf</i>. If code does need to rely on such a file, include a description of the file and its format in the code's documentation, and make it easy for the user to override the default location of the file.</p> <h2 id="System-Interaction"><a class="permalink" href="#System-Interaction">#</a><a id="System"></a>System Interaction</h2> <p>Not all platforms provide for the notion of a command line, necessarily. These are usually platforms that rely on a Graphical User Interface (GUI) for user interaction. So a program requiring command lines might not work everywhere. But this is probably for the user of the program to deal with.</p> <p>Some platforms can't delete or rename files that are being held open by the system. Remember to <code>close</code> files when you are done with them. Don't <code>unlink</code> or <code>rename</code> an open file. Don't <code>tie</code> to or <code>open</code> a file that is already tied to or opened; <code>untie</code> or <code>close</code> first.</p> <p>Don't count on a specific environment variable existing in <code>%ENV</code>. Don't even count on <code>%ENV</code> entries being case-sensitive, or even case-preserving.</p> <p>Don't count on signals in portable programs.</p> <p>Don't count on filename globbing. Use <code>opendir</code>, <code>readdir</code>, and <code>closedir</code> instead.</p> <h2 id="Interprocess-Communication-(IPC)"><a class="permalink" href="#Interprocess-Communication-(IPC)">#</a><a id="Interprocess"></a><a id="Interprocess-Communication-IPC"></a>Interprocess Communication (IPC)</h2> <p>In general, don't directly access the system in code that is meant to be portable. That means, no: <code>system</code>, <code>exec</code>, <code>fork</code>, <code>pipe</code>, <code>``</code>, <code>qx//</code>, <code>open</code> with a <code>|</code>, or any of the other things that makes being a Unix perl hacker worth being.</p> <p>Commands that launch external processes are generally supported on most platforms (though many of them do not support any type of forking), but the problem with using them arises from what you invoke with them. External tools are often named differently on different platforms, often not available in the same location, often accept different arguments, often behave differently, and often represent their results in a platform-dependent way. Thus you should seldom depend on them to produce consistent results.</p> <p>One especially common bit of Perl code is opening a pipe to sendmail:</p> <pre><code>open(MAIL, '|/usr/lib/sendmail -t') or die $!;</code></pre> <p>This is fine for systems programming when sendmail is known to be available. But it is not fine for many non-Unix systems, and even some Unix systems that may not have sendmail installed. If a portable solution is needed, see the <code>Mail::Send</code> and <code>Mail::Mailer</code> modules in the <code>MailTools</code> distribution. <code>Mail::Mailer</code> provides several mailing methods, including mail, sendmail, and direct SMTP (via <code>Net::SMTP</code>) if a mail transfer agent is not available.</p> <p>The rule of thumb for portable code is: Do it all in portable Perl, or use a module that may internally implement it with platform-specific code, but expose a common interface. By portable Perl, we mean code that avoids the constructs described in this document as being non-portable.</p> <h2 id="External-Subroutines-(XS)"><a class="permalink" href="#External-Subroutines-(XS)">#</a><a id="External"></a><a id="External-Subroutines-XS"></a>External Subroutines (XS)</h2> <p>XS code, in general, can be made to work with any platform; but dependent libraries, header files, etc., might not be readily available or portable, or the XS code itself might be platform-specific, just as Perl code might be. If the libraries and headers are portable, then it is normally reasonable to make sure the XS code is portable, too.</p> <p>There is a different kind of portability issue with writing XS code: availability of a C compiler on the end-user's system. C brings with it its own portability issues, and writing XS code will expose you to some of those. Writing purely in perl is a comparatively easier way to achieve portability.</p> <h2 id="Standard-Modules"><a class="permalink" href="#Standard-Modules">#</a><a id="Standard"></a>Standard Modules</h2> <p>In general, the standard modules work across platforms. Notable exceptions are <code>CPAN.pm</code> (which currently makes connections to external programs that may not be available), platform-specific modules (like <code>ExtUtils::MM_VMS</code>), and DBM modules.</p> <p>There is no one DBM module that is available on all platforms. <code>SDBM_File</code> and the others are generally available on all Unix and DOSish ports, but not in MacPerl, where <code>NBDM_File</code> and <code>DB_File</code> are available.</p> <p>The good news is that at least some DBM module should be available, and <code>AnyDBM_File</code> will use whichever module it can find. Of course, then the code needs to be fairly strict, dropping to the lowest common denominator (e.g., not exceeding 1K for each record).</p> <h2 id="Time-and-Date"><a class="permalink" href="#Time-and-Date">#</a><a id="Time"></a>Time and Date</h2> <p>The system's notion of time of day and calendar date is controlled in widely different ways. Don't assume the timezone is stored in <code>$ENV{TZ}</code>, and even if it is, don't assume that you can control the timezone through that variable.</p> <p>Don't assume that the epoch starts at January 1, 1970, because that is OS-specific. Better to store a date in an unambiguous representation. A text representation (like <code>1 Jan 1970</code>) can be easily converted into an OS-specific value using a module like <code>Date::Parse</code>. An array of values, such as those returned by <code>localtime</code>, can be converted to an OS-specific representation using <code>Time::Local</code>.</p> <h2 id="System-Resources"><a class="permalink" href="#System-Resources">#</a><a id="System1"></a>System Resources</h2> <p>If your code is destined for systems with severely constrained (or missing!) virtual memory systems then you want to be especially mindful of avoiding wasteful constructs such as:</p> <pre><code># NOTE: this is no longer "bad" in perl5.005 for (0..10000000) {} # bad for (my $x = 0; $x <= 10000000; ++$x) {} # good @lines = <VERY_LARGE_FILE>; # bad while (<FILE>) {$file .= $_} # sometimes bad $file = join '', <FILE>; # better</code></pre> <p>The last two may appear unintuitive to most people. The first of those two constructs repeatedly grows a string, while the second allocates a large chunk of memory in one go. On some systems, the latter is more efficient that the former.</p> <h2 id="Security"><a class="permalink" href="#Security">#</a>Security</h2> <p>Most Unix platforms provide basic levels of security that is usually felt at the file-system level. Other platforms usually don't (unfortunately). Thus the notion of User-ID, or "home" directory, or even the state of being logged-in may be unrecognizable on may platforms. If you write programs that are security conscious, it is usually best to know what type of system you will be operating under, and write code explicitly for that platform (or class of platforms).</p> <h2 id="Style"><a class="permalink" href="#Style">#</a>Style</h2> <p>For those times when it is necessary to have platform-specific code, consider keeping the platform-specific code in one place, making porting to other platforms easier. Use the <code>Config</code> module and the special variable <code>$^O</code> to differentiate platforms, as described in <a href="#PLATFORMS">"PLATFORMS"</a>.</p> <h1 id="CPAN-TESTERS"><a class="permalink" href="#CPAN-TESTERS">#</a><a id="CPAN"></a>CPAN TESTERS</h1> <p>Module uploaded to CPAN are tested by a variety of volunteers on different platforms. These CPAN testers are notified by e-mail of each new upload, and reply to the list with PASS, FAIL, NA (not applicable to this platform), or ???? (unknown), along with any relevant notations.</p> <p>The purpose of the testing is twofold: one, to help developers fix any problems in their code; two, to provide users with information about whether or not a given module works on a given platform.</p> <dl> <dt id="Mailing-list:-cpan-testers@perl.org"><a class="permalink" href="#Mailing-list:-cpan-testers@perl.org">#</a><a id="Mailing"></a><a id="Mailing-list:-cpan-testers-perl.org"></a>Mailing list: cpan-testers@perl.org</dt> <dd> </dd> <dt id="Testing-results:-http://www.connect.net/gbarr/cpan-test/"><a class="permalink" href="#Testing-results:-http://www.connect.net/gbarr/cpan-test/">#</a><a id="Testing"></a><a id="Testing-results:-http:-www.connect.net-gbarr-cpan-test"></a>Testing results: <code>http://www.connect.net/gbarr/cpan-test/</code></dt> <dd> </dd> </dl> <h1 id="PLATFORMS"><a class="permalink" href="#PLATFORMS">#</a>PLATFORMS</h1> <p>As of version 5.002, Perl is built with a <code>$^O</code> variable that indicates the operating system it was built on. This was implemented to help speed up code that would otherwise have to <code>use Config;</code> and use the value of <code>$Config{'osname'}</code>. Of course, to get detailed information about the system, looking into <code>%Config</code> is certainly recommended.</p> <h2 id="Unix"><a class="permalink" href="#Unix">#</a>Unix</h2> <p>Perl works on a bewildering variety of Unix and Unix-like platforms (see e.g. most of the files in the <i>hints/</i> directory in the source code kit). On most of these systems, the value of <code>$^O</code> (hence <code>$Config{'osname'}</code>, too) is determined by lowercasing and stripping punctuation from the first field of the string returned by typing</p> <pre><code class="plaintext">% uname -a</code></pre> <p>(or a similar command) at the shell prompt. Here, for example, are a few of the more popular Unix flavors:</p> <pre><code class="plaintext">uname $^O -------------------- AIX aix FreeBSD freebsd Linux linux HP-UX hpux OSF1 dec_osf SunOS solaris SunOS4 sunos</code></pre> <h2 id="DOS-and-Derivatives"><a class="permalink" href="#DOS-and-Derivatives">#</a><a id="DOS"></a>DOS and Derivatives</h2> <p>Perl has long been ported to PC style microcomputers running under systems like PC-DOS, MS-DOS, OS/2, and most Windows platforms you can bring yourself to mention (except for Windows CE, if you count that). Users familiar with <i>COMMAND.COM</i> and/or <i>CMD.EXE</i> style shells should be aware that each of these file specifications may have subtle differences:</p> <pre><code>$filespec0 = "c:/foo/bar/file.txt"; $filespec1 = "c:\\foo\\bar\\file.txt"; $filespec2 = 'c:\foo\bar\file.txt'; $filespec3 = 'c:\\foo\\bar\\file.txt';</code></pre> <p>System calls accept either <code>/</code> or <code>\</code> as the path separator. However, many command-line utilities of DOS vintage treat <code>/</code> as the option prefix, so they may get confused by filenames containing <code>/</code>. Aside from calling any external programs, <code>/</code> will work just fine, and probably better, as it is more consistent with popular usage, and avoids the problem of remembering what to backwhack and what not to.</p> <p>The DOS FAT file system can only accomodate "8.3" style filenames. Under the "case insensitive, but case preserving" HPFS (OS/2) and NTFS (NT) file systems you may have to be careful about case returned with functions like <code>readdir</code> or used with functions like <code>open</code> or <code>opendir</code>.</p> <p>DOS also treats several filenames as special, such as AUX, PRN, NUL, CON, COM1, LPT1, LPT2 etc. Unfortunately these filenames won't even work if you include an explicit directory prefix, in some cases. It is best to avoid such filenames, if you want your code to be portable to DOS and its derivatives.</p> <p>Users of these operating systems may also wish to make use of scripts such as <i>pl2bat.bat</i> or <i>pl2cmd</i> as appropriate to put wrappers around your scripts.</p> <p>Newline (<code>\n</code>) is translated as <code>\015\012</code> by STDIO when reading from and writing to files. <code>binmode(FILEHANDLE)</code> will keep <code>\n</code> translated as <code>\012</code> for that filehandle. Since it is a noop on other systems, <code>binmode</code> should be used for cross-platform code that deals with binary data.</p> <p>The <code>$^O</code> variable and the <code>$Config{'archname'}</code> values for various DOSish perls are as follows:</p> <pre><code>OS $^O $Config{'archname'} -------------------------------------------- MS-DOS dos PC-DOS dos OS/2 os2 Windows 95 MSWin32 MSWin32-x86 Windows NT MSWin32 MSWin32-x86 Windows NT MSWin32 MSWin32-alpha Windows NT MSWin32 MSWin32-ppc</code></pre> <p>Also see:</p> <dl> <dt id="The-djgpp-environment-for-DOS,-http://www.delorie.com/djgpp/"><a class="permalink" href="#The-djgpp-environment-for-DOS,-http://www.delorie.com/djgpp/">#</a><a id="The1"></a><a id="The-djgpp-environment-for-DOS-http:-www.delorie.com-djgpp"></a>The djgpp environment for DOS, <code>http://www.delorie.com/djgpp/</code></dt> <dd> </dd> <dt id="The-EMX-environment-for-DOS,-OS/2,-etc.-emx@iaehv.nl,-http://www.juge.com/bbs/Hobb.19.html"><a class="permalink" href="#The-EMX-environment-for-DOS,-OS/2,-etc.-emx@iaehv.nl,-http://www.juge.com/bbs/Hobb.19.html">#</a><a id="The2"></a><a id="The-EMX-environment-for-DOS-OS-2-etc.-emx-iaehv.nl-http:-www.juge.com-bbs-Hobb.19.html"></a>The EMX environment for DOS, OS/2, etc. <code>emx@iaehv.nl</code>, <code>http://www.juge.com/bbs/Hobb.19.html</code></dt> <dd> </dd> <dt id="Build-instructions-for-Win32,-perlwin32."><a class="permalink" href="#Build-instructions-for-Win32,-perlwin32.">#</a><a id="Build"></a><a id="Build-instructions-for-Win32-perlwin32"></a>Build instructions for Win32, <a href="/5.005_01/perlwin32">perlwin32</a>.</dt> <dd> </dd> <dt id="The-ActiveState-Pages,-http://www.activestate.com/"><a class="permalink" href="#The-ActiveState-Pages,-http://www.activestate.com/">#</a><a id="The3"></a><a id="The-ActiveState-Pages-http:-www.activestate.com"></a>The ActiveState Pages, <code>http://www.activestate.com/</code></dt> <dd> </dd> </dl> <h2 id="MacPerl"><a class="permalink" href="#MacPerl">#</a>MacPerl</h2> <p>Any module requiring XS compilation is right out for most people, because MacPerl is built using non-free (and non-cheap!) compilers. Some XS modules that can work with MacPerl are built and distributed in binary form on CPAN. See <i>MacPerl: Power and Ease</i> for more details.</p> <p>Directories are specified as:</p> <pre><code class="plaintext">volume:folder:file for absolute pathnames volume:folder: for absolute pathnames :folder:file for relative pathnames :folder: for relative pathnames :file for relative pathnames file for relative pathnames</code></pre> <p>Files in a directory are stored in alphabetical order. Filenames are limited to 31 characters, and may include any character except <code>:</code>, which is reserved as a path separator.</p> <p>Instead of <code>flock</code>, see <code>FSpSetFLock</code> and <code>FSpRstFLock</code> in <code>Mac::Files</code>.</p> <p>In the MacPerl application, you can't run a program from the command line; programs that expect <code>@ARGV</code> to be populated can be edited with something like the following, which brings up a dialog box asking for the command line arguments.</p> <pre><code>if (!@ARGV) { @ARGV = split /\s+/, MacPerl::Ask('Arguments?'); }</code></pre> <p>A MacPerl script saved as a droplet will populate <code>@ARGV</code> with the full pathnames of the files dropped onto the script.</p> <p>Mac users can use programs on a kind of command line under MPW (Macintosh Programmer's Workshop, a free development environment from Apple). MacPerl was first introduced as an MPW tool, and MPW can be used like a shell:</p> <pre><code class="plaintext">perl myscript.plx some arguments</code></pre> <p>ToolServer is another app from Apple that provides access to MPW tools from MPW and the MacPerl app, which allows MacPerl program to use <code>system</code>, backticks, and piped <code>open</code>.</p> <p>"<span style="white-space: nowrap;">Mac OS</span>" is the proper name for the operating system, but the value in <code>$^O</code> is "MacOS". To determine architecture, version, or whether the application or MPW tool version is running, check:</p> <pre><code>$is_app = $MacPerl::Version =~ /App/; $is_tool = $MacPerl::Version =~ /MPW/; ($version) = $MacPerl::Version =~ /^(\S+)/; $is_ppc = $MacPerl::Architecture eq 'MacPPC'; $is_68k = $MacPerl::Architecture eq 'Mac68K';</code></pre> <p>Also see:</p> <dl> <dt id="The-MacPerl-Pages,-http://www.ptf.com/macperl/."><a class="permalink" href="#The-MacPerl-Pages,-http://www.ptf.com/macperl/.">#</a><a id="The4"></a><a id="The-MacPerl-Pages-http:-www.ptf.com-macperl"></a>The MacPerl Pages, <code>http://www.ptf.com/macperl/</code>.</dt> <dd> </dd> <dt id="The-MacPerl-mailing-list,-mac-perl-request@iis.ee.ethz.ch."><a class="permalink" href="#The-MacPerl-mailing-list,-mac-perl-request@iis.ee.ethz.ch.">#</a><a id="The5"></a><a id="The-MacPerl-mailing-list-mac-perl-request-iis.ee.ethz.ch"></a>The MacPerl mailing list, <code>mac-perl-request@iis.ee.ethz.ch</code>.</dt> <dd> </dd> </dl> <h2 id="VMS"><a class="permalink" href="#VMS">#</a>VMS</h2> <p>Perl on VMS is discussed in <i>vms/perlvms.pod</i> in the perl distribution. Note that perl on VMS can accept either VMS or Unix style file specifications as in either of the following:</p> <pre><code>$ perl -ne "print if /perl_setup/i" SYS$LOGIN:LOGIN.COM $ perl -ne "print if /perl_setup/i" /sys$login/login.com</code></pre> <p>but not a mixture of both as in:</p> <pre><code>$ perl -ne "print if /perl_setup/i" sys$login:/login.com Can't open sys$login:/login.com: file specification syntax error</code></pre> <p>Interacting with Perl from the Digital Command Language (DCL) shell often requires a different set of quotation marks than Unix shells do. For example:</p> <pre><code class="plaintext">$ perl -e "print ""Hello, world.\n""" Hello, world.</code></pre> <p>There are a number of ways to wrap your perl scripts in DCL .COM files if you are so inclined. For example:</p> <pre><code>$ write sys$output "Hello from DCL!" $ if p1 .eqs. "" $ then perl -x 'f$environment("PROCEDURE") $ else perl -x - 'p1 'p2 'p3 'p4 'p5 'p6 'p7 'p8 $ deck/dollars="__END__" #!/usr/bin/perl print "Hello from Perl!\n"; __END__ $ endif</code></pre> <p>Do take care with <code>$ ASSIGN/nolog/user SYS$COMMAND: SYS$INPUT</code> if your perl-in-DCL script expects to do things like <code>$read = <STDIN>;</code>.</p> <p>Filenames are in the format "name.extension;version". The maximum length for filenames is 39 characters, and the maximum length for extensions is also 39 characters. Version is a number from 1 to 32767. Valid characters are <code>/[A-Z0-9$_-]/</code>.</p> <p>VMS' RMS filesystem is case insensitive and does not preserve case. <code>readdir</code> returns lowercased filenames, but specifying a file for opening remains case insensitive. Files without extensions have a trailing period on them, so doing a <code>readdir</code> with a file named <i>A.;5</i> will return <i>a.</i> (though that file could be opened with <code>open(FH, 'A')</code>.</p> <p>RMS has an eight level limit on directory depths from any rooted logical (allowing 16 levels overall). Hence <code>PERL_ROOT:[LIB.2.3.4.5.6.7.8]</code> is a valid directory specification but <code>PERL_ROOT:[LIB.2.3.4.5.6.7.8.9]</code> is not. <i>Makefile.PL</i> authors might have to take this into account, but at least they can refer to the former as <code>/PERL_ROOT/lib/2/3/4/5/6/7/8/</code>.</p> <p>The <code>VMS::Filespec</code> module, which gets installed as part of the build process on VMS, is a pure Perl module that can easily be installed on non-VMS platforms and can be helpful for conversions to and from RMS native formats.</p> <p>What <code>\n</code> represents depends on the type of file that is open. It could be <code>\015</code>, <code>\012</code>, <code>\015\012</code>, or nothing. Reading from a file translates newlines to <code>\012</code>, unless <code>binmode</code> was executed on that handle, just like DOSish perls.</p> <p>TCP/IP stacks are optional on VMS, so socket routines might not be implemented. UDP sockets may not be supported.</p> <p>The value of <code>$^O</code> on OpenVMS is "VMS". To determine the architecture that you are running on without resorting to loading all of <code>%Config</code> you can examine the content of the <code>@INC</code> array like so:</p> <pre><code>if (grep(/VMS_AXP/, @INC)) { print "I'm on Alpha!\n"; } elsif (grep(/VMS_VAX/, @INC)) { print "I'm on VAX!\n"; } else { print "I'm not so sure about where $^O is...\n"; }</code></pre> <p>Also see:</p> <dl> <dt id="perlvms.pod"><a class="permalink" href="#perlvms.pod">#</a><a id="perlvms"></a><a href="/5.005_01/perlvms.pod">perlvms.pod</a></dt> <dd> </dd> <dt id="vmsperl-list,-vmsperl-request@newman.upenn.edu"><a class="permalink" href="#vmsperl-list,-vmsperl-request@newman.upenn.edu">#</a><a id="vmsperl"></a><a id="vmsperl-list-vmsperl-request-newman.upenn.edu"></a>vmsperl list, <code>vmsperl-request@newman.upenn.edu</code></dt> <dd> <p>Put words <code>SUBSCRIBE VMSPERL</code> in message body.</p> </dd> <dt id="vmsperl-on-the-web,-http://www.sidhe.org/vmsperl/index.html"><a class="permalink" href="#vmsperl-on-the-web,-http://www.sidhe.org/vmsperl/index.html">#</a><a id="vmsperl1"></a><a id="vmsperl-on-the-web-http:-www.sidhe.org-vmsperl-index.html"></a>vmsperl on the web, <code>http://www.sidhe.org/vmsperl/index.html</code></dt> <dd> </dd> </dl> <h2 id="EBCDIC-Platforms"><a class="permalink" href="#EBCDIC-Platforms">#</a><a id="EBCDIC"></a>EBCDIC Platforms</h2> <p>Recent versions of Perl have been ported to platforms such as OS/400 on AS/400 minicomputers as well as OS/390 for IBM Mainframes. Such computers use EBCDIC character sets internally (usually Character Code Set ID 00819 for OS/400 and IBM-1047 for OS/390). Note that on the mainframe perl currently works under the "Unix system services for OS/390" (formerly known as OpenEdition).</p> <p>As of R2.5 of USS for OS/390 that Unix sub-system did not support the <code>#!</code> shebang trick for script invocation. Hence, on OS/390 perl scripts can executed with a header similar to the following simple script:</p> <pre><code>: # use perl eval 'exec /usr/local/bin/perl -S $0 ${1+"$@"}' if 0; #!/usr/local/bin/perl # just a comment really print "Hello from perl!\n";</code></pre> <p>On these platforms, bear in mind that the EBCDIC character set may have an effect on what happens with perl functions such as <code>chr</code>, <code>pack</code>, <code>print</code>, <code>printf</code>, <code>ord</code>, <code>sort</code>, <code>sprintf</code>, <code>unpack</code>; as well as bit-fiddling with ASCII constants using operators like <code>^</code>, <code>&</code> and <code>|</code>; not to mention dealing with socket interfaces to ASCII computers (see <a href="#NEWLINES">"NEWLINES"</a>).</p> <p>Fortunately, most web servers for the mainframe will correctly translate the <code>\n</code> in the following statement to its ASCII equivalent (note that <code>\r</code> is the same under both ASCII and EBCDIC):</p> <pre><code>print "Content-type: text/html\r\n\r\n";</code></pre> <p>The value of <code>$^O</code> on OS/390 is "os390".</p> <p>Some simple tricks for determining if you are running on an EBCDIC platform could include any of the following (perhaps all):</p> <pre><code class="plaintext">if ("\t" eq "\05") { print "EBCDIC may be spoken here!\n"; } if (ord('A') == 193) { print "EBCDIC may be spoken here!\n"; } if (chr(169) eq 'z') { print "EBCDIC may be spoken here!\n"; }</code></pre> <p>Note that one thing you may not want to rely on is the EBCDIC encoding of punctuation characters since these may differ from code page to code page (and once your module or script is rumoured to work with EBCDIC, folks will want it to work with all EBCDIC character sets).</p> <p>Also see:</p> <dl> <dt id="perl-mvs-list"><a class="permalink" href="#perl-mvs-list">#</a><a id="perl"></a>perl-mvs list</dt> <dd> <p>The perl-mvs@perl.org list is for discussion of porting issues as well as general usage issues for all EBCDIC Perls. Send a message body of "subscribe perl-mvs" to majordomo@perl.org.</p> </dd> <dt id="AS/400-Perl-information-at-http://as400.rochester.ibm.com"><a class="permalink" href="#AS/400-Perl-information-at-http://as400.rochester.ibm.com">#</a><a id="AS"></a><a id="AS-400-Perl-information-at-http:-as400.rochester.ibm.com"></a>AS/400 Perl information at <code>http://as400.rochester.ibm.com</code></dt> <dd> </dd> </dl> <h2 id="Other-perls"><a class="permalink" href="#Other-perls">#</a><a id="Other"></a>Other perls</h2> <p>Perl has been ported to a variety of platforms that do not fit into any of the above categories. Some, such as AmigaOS, BeOS, QNX, and Plan 9, have been well integrated into the standard Perl source code kit. You may need to see the <i>ports/</i> directory on CPAN for information, and possibly binaries, for the likes of: acorn, aos, atari, lynxos, HP-MPE/iX, riscos, Tandem Guardian, vos, <i>etc.</i> (yes we know that some of these OSes may fall under the Unix category but we are not a standards body.)</p> <p>See also:</p> <dl> <dt id="Atari,-Guido-Flohr's-page-http://stud.uni-sb.de/~gufl0000/"><a class="permalink" href="#Atari,-Guido-Flohr's-page-http://stud.uni-sb.de/~gufl0000/">#</a><a id="Atari"></a><a id="Atari-Guido-Flohrs-page-http:-stud.uni-sb.de-gufl0000"></a>Atari, Guido Flohr's page <code>http://stud.uni-sb.de/~gufl0000/</code></dt> <dd> </dd> <dt id="HP-300-MPE/iX-http://www.cccd.edu/~markb/perlix.html"><a class="permalink" href="#HP-300-MPE/iX-http://www.cccd.edu/~markb/perlix.html">#</a><a id="HP"></a><a id="HP-300-MPE-iX-http:-www.cccd.edu-markb-perlix.html"></a>HP 300 MPE/iX <code>http://www.cccd.edu/~markb/perlix.html</code></dt> <dd> </dd> <dt id="Novell-Netware"><a class="permalink" href="#Novell-Netware">#</a><a id="Novell"></a>Novell Netware</dt> <dd> <p>A free Perl 5 based PERL.NLM for Novell Netware is available from <code>http://www.novell.com/</code></p> </dd> </dl> <h1 id="FUNCTION-IMPLEMENTATIONS"><a class="permalink" href="#FUNCTION-IMPLEMENTATIONS">#</a><a id="FUNCTION"></a>FUNCTION IMPLEMENTATIONS</h1> <p>Listed below are functions unimplemented or implemented differently on various platforms. Following each description will be, in parentheses, a list of platforms that the description applies to.</p> <p>The list may very well be incomplete, or wrong in some places. When in doubt, consult the platform-specific README files in the Perl source distribution, and other documentation resources for a given port.</p> <p>Be aware, moreover, that even among Unix-ish systems there are variations, and not all functions listed here are necessarily available, though most usually are.</p> <p>For many functions, you can also query <code>%Config</code>, exported by default from <code>Config.pm</code>. For example, to check if the platform has the <code>lstat</code> call, check <code>$Config{'d_lstat'}</code>. See <a href="/5.005_01/Config">Config</a> for a full description of available variables.</p> <h2 id="Alphabetical-Listing-of-Perl-Functions"><a class="permalink" href="#Alphabetical-Listing-of-Perl-Functions">#</a><a id="Alphabetical"></a>Alphabetical Listing of Perl Functions</h2> <dl> <dt id="-X-FILEHANDLE"><a class="permalink" href="#-X-FILEHANDLE">#</a><a id="X-FILEHANDLE"></a>-X FILEHANDLE</dt> <dd> </dd> <dt id="-X-EXPR"><a class="permalink" href="#-X-EXPR">#</a><a id="X-EXPR"></a>-X EXPR</dt> <dd> </dd> <dt id="-X"><a class="permalink" href="#-X">#</a><a id="X"></a>-X</dt> <dd> <p><code>-r</code>, <code>-w</code>, and <code>-x</code> have only a very limited meaning; directories and applications are executable, and there are no uid/gid considerations. <code>-o</code> is not supported. (<span style="white-space: nowrap;">Mac OS</span>)</p> <p><code>-r</code>, <code>-w</code>, <code>-x</code>, and <code>-o</code> tell whether or not file is accessible, which may not reflect UIC-based file protections. (VMS)</p> <p><code>-R</code>, <code>-W</code>, <code>-X</code>, <code>-O</code> are indistinguishable from <code>-r</code>, <code>-w</code>, <code>-x</code>, <code>-o</code>. (<span style="white-space: nowrap;">Mac OS</span>, Win32, VMS)</p> <p><code>-b</code>, <code>-c</code>, <code>-k</code>, <code>-g</code>, <code>-p</code>, <code>-u</code>, <code>-A</code> are not implemented. (<span style="white-space: nowrap;">Mac OS</span>)</p> <p><code>-g</code>, <code>-k</code>, <code>-l</code>, <code>-p</code>, <code>-u</code>, <code>-A</code> are not particularly meaningful. (Win32, VMS)</p> <p><code>-d</code> is true if passed a device spec without an explicit directory. (VMS)</p> <p><code>-T</code> and <code>-B</code> are implemented, but might misclassify Mac text files with foreign characters; this is the case will all platforms, but affects <span style="white-space: nowrap;">Mac OS</span> a lot. (<span style="white-space: nowrap;">Mac OS</span>)</p> <p><code>-x</code> (or <code>-X</code>) determine if a file ends in one of the executable suffixes. <code>-S</code> is meaningless. (Win32)</p> </dd> <dt id="binmode-FILEHANDLE"><a class="permalink" href="#binmode-FILEHANDLE">#</a><a id="binmode"></a>binmode FILEHANDLE</dt> <dd> <p>Meaningless. (<span style="white-space: nowrap;">Mac OS</span>)</p> <p>Reopens file and restores pointer; if function fails, underlying filehandle may be closed, or pointer may be in a different position. (VMS)</p> <p>The value returned by <code>tell</code> may be affected after the call, and the filehandle may be flushed. (Win32)</p> </dd> <dt id="chmod-LIST"><a class="permalink" href="#chmod-LIST">#</a><a id="chmod"></a>chmod LIST</dt> <dd> <p>Only limited meaning. Disabling/enabling write permission is mapped to locking/unlocking the file. (<span style="white-space: nowrap;">Mac OS</span>)</p> <p>Only good for changing "owner" read-write access, "group", and "other" bits are meaningless. (Win32)</p> </dd> <dt id="chown-LIST"><a class="permalink" href="#chown-LIST">#</a><a id="chown"></a>chown LIST</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>, Win32, Plan9)</p> <p>Does nothing, but won't fail. (Win32)</p> </dd> <dt id="chroot-FILENAME"><a class="permalink" href="#chroot-FILENAME">#</a><a id="chroot1"></a>chroot FILENAME</dt> <dd> </dd> <dt id="chroot"><a class="permalink" href="#chroot">#</a>chroot</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>, Win32, VMS, Plan9)</p> </dd> <dt id="crypt-PLAINTEXT,SALT"><a class="permalink" href="#crypt-PLAINTEXT,SALT">#</a><a id="crypt"></a><a id="crypt-PLAINTEXT-SALT"></a>crypt PLAINTEXT,SALT</dt> <dd> <p>May not be available if library or source was not provided when building perl. (Win32)</p> </dd> <dt id="dbmclose-HASH"><a class="permalink" href="#dbmclose-HASH">#</a><a id="dbmclose"></a>dbmclose HASH</dt> <dd> <p>Not implemented. (VMS, Plan9)</p> </dd> <dt id="dbmopen-HASH,DBNAME,MODE"><a class="permalink" href="#dbmopen-HASH,DBNAME,MODE">#</a><a id="dbmopen"></a><a id="dbmopen-HASH-DBNAME-MODE"></a>dbmopen HASH,DBNAME,MODE</dt> <dd> <p>Not implemented. (VMS, Plan9)</p> </dd> <dt id="dump-LABEL"><a class="permalink" href="#dump-LABEL">#</a><a id="dump"></a>dump LABEL</dt> <dd> <p>Not useful. (<span style="white-space: nowrap;">Mac OS</span>)</p> <p>Not implemented. (Win32)</p> <p>Invokes VMS debugger. (VMS)</p> </dd> <dt id="exec-LIST"><a class="permalink" href="#exec-LIST">#</a><a id="exec"></a>exec LIST</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>)</p> </dd> <dt id="fcntl-FILEHANDLE,FUNCTION,SCALAR"><a class="permalink" href="#fcntl-FILEHANDLE,FUNCTION,SCALAR">#</a><a id="fcntl"></a><a id="fcntl-FILEHANDLE-FUNCTION-SCALAR"></a>fcntl FILEHANDLE,FUNCTION,SCALAR</dt> <dd> <p>Not implemented. (Win32, VMS)</p> </dd> <dt id="flock-FILEHANDLE,OPERATION"><a class="permalink" href="#flock-FILEHANDLE,OPERATION">#</a><a id="flock"></a><a id="flock-FILEHANDLE-OPERATION"></a>flock FILEHANDLE,OPERATION</dt> <dd> <p>Not implemented (<span style="white-space: nowrap;">Mac OS</span>, VMS).</p> <p>Available only on Windows NT (not on Windows 95). (Win32)</p> </dd> <dt id="fork"><a class="permalink" href="#fork">#</a>fork</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>, Win32, AmigaOS)</p> </dd> <dt id="getlogin"><a class="permalink" href="#getlogin">#</a>getlogin</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>)</p> </dd> <dt id="getpgrp-PID"><a class="permalink" href="#getpgrp-PID">#</a><a id="getpgrp"></a>getpgrp PID</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>, Win32, VMS)</p> </dd> <dt id="getppid"><a class="permalink" href="#getppid">#</a>getppid</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>, Win32, VMS)</p> </dd> <dt id="getpriority-WHICH,WHO"><a class="permalink" href="#getpriority-WHICH,WHO">#</a><a id="getpriority"></a><a id="getpriority-WHICH-WHO"></a>getpriority WHICH,WHO</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>, Win32, VMS)</p> </dd> <dt id="getpwnam-NAME"><a class="permalink" href="#getpwnam-NAME">#</a><a id="getpwnam"></a>getpwnam NAME</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>, Win32)</p> </dd> <dt id="getgrnam-NAME"><a class="permalink" href="#getgrnam-NAME">#</a><a id="getgrnam"></a>getgrnam NAME</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>, Win32, VMS)</p> </dd> <dt id="getnetbyname-NAME"><a class="permalink" href="#getnetbyname-NAME">#</a><a id="getnetbyname"></a>getnetbyname NAME</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>, Win32, Plan9)</p> </dd> <dt id="getpwuid-UID"><a class="permalink" href="#getpwuid-UID">#</a><a id="getpwuid"></a>getpwuid UID</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>, Win32)</p> </dd> <dt id="getgrgid-GID"><a class="permalink" href="#getgrgid-GID">#</a><a id="getgrgid"></a>getgrgid GID</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>, Win32, VMS)</p> </dd> <dt id="getnetbyaddr-ADDR,ADDRTYPE"><a class="permalink" href="#getnetbyaddr-ADDR,ADDRTYPE">#</a><a id="getnetbyaddr"></a><a id="getnetbyaddr-ADDR-ADDRTYPE"></a>getnetbyaddr ADDR,ADDRTYPE</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>, Win32, Plan9)</p> </dd> <dt id="getprotobynumber-NUMBER"><a class="permalink" href="#getprotobynumber-NUMBER">#</a><a id="getprotobynumber"></a>getprotobynumber NUMBER</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>)</p> </dd> <dt id="getservbyport-PORT,PROTO"><a class="permalink" href="#getservbyport-PORT,PROTO">#</a><a id="getservbyport"></a><a id="getservbyport-PORT-PROTO"></a>getservbyport PORT,PROTO</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>)</p> </dd> <dt id="getpwent"><a class="permalink" href="#getpwent">#</a>getpwent</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>, Win32)</p> </dd> <dt id="getgrent"><a class="permalink" href="#getgrent">#</a>getgrent</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>, Win32, VMS)</p> </dd> <dt id="gethostent"><a class="permalink" href="#gethostent">#</a>gethostent</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>, Win32)</p> </dd> <dt id="getnetent"><a class="permalink" href="#getnetent">#</a>getnetent</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>, Win32, Plan9)</p> </dd> <dt id="getprotoent"><a class="permalink" href="#getprotoent">#</a>getprotoent</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>, Win32, Plan9)</p> </dd> <dt id="getservent"><a class="permalink" href="#getservent">#</a>getservent</dt> <dd> <p>Not implemented. (Win32, Plan9)</p> </dd> <dt id="setpwent"><a class="permalink" href="#setpwent">#</a>setpwent</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>, Win32)</p> </dd> <dt id="setgrent"><a class="permalink" href="#setgrent">#</a>setgrent</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>, Win32, VMS)</p> </dd> <dt id="sethostent-STAYOPEN"><a class="permalink" href="#sethostent-STAYOPEN">#</a><a id="sethostent"></a>sethostent STAYOPEN</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>, Win32, Plan9)</p> </dd> <dt id="setnetent-STAYOPEN"><a class="permalink" href="#setnetent-STAYOPEN">#</a><a id="setnetent"></a>setnetent STAYOPEN</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>, Win32, Plan9)</p> </dd> <dt id="setprotoent-STAYOPEN"><a class="permalink" href="#setprotoent-STAYOPEN">#</a><a id="setprotoent"></a>setprotoent STAYOPEN</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>, Win32, Plan9)</p> </dd> <dt id="setservent-STAYOPEN"><a class="permalink" href="#setservent-STAYOPEN">#</a><a id="setservent"></a>setservent STAYOPEN</dt> <dd> <p>Not implemented. (Plan9, Win32)</p> </dd> <dt id="endpwent"><a class="permalink" href="#endpwent">#</a>endpwent</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>, Win32)</p> </dd> <dt id="endgrent"><a class="permalink" href="#endgrent">#</a>endgrent</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>, Win32, VMS)</p> </dd> <dt id="endhostent"><a class="permalink" href="#endhostent">#</a>endhostent</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>, Win32)</p> </dd> <dt id="endnetent"><a class="permalink" href="#endnetent">#</a>endnetent</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>, Win32, Plan9)</p> </dd> <dt id="endprotoent"><a class="permalink" href="#endprotoent">#</a>endprotoent</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>, Win32, Plan9)</p> </dd> <dt id="endservent"><a class="permalink" href="#endservent">#</a>endservent</dt> <dd> <p>Not implemented. (Plan9, Win32)</p> </dd> <dt id="getsockopt-SOCKET,LEVEL,OPTNAME"><a class="permalink" href="#getsockopt-SOCKET,LEVEL,OPTNAME">#</a><a id="getsockopt"></a><a id="getsockopt-SOCKET-LEVEL-OPTNAME"></a>getsockopt SOCKET,LEVEL,OPTNAME</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>, Plan9)</p> </dd> <dt id="glob-EXPR"><a class="permalink" href="#glob-EXPR">#</a><a id="glob1"></a>glob EXPR</dt> <dd> </dd> <dt id="glob"><a class="permalink" href="#glob">#</a>glob</dt> <dd> <p>Globbing built-in, but only <code>*</code> and <code>?</code> metacharacters are supported. (<span style="white-space: nowrap;">Mac OS</span>)</p> <p>Features depend on external perlglob.exe or perlglob.bat. May be overridden with something like File::DosGlob, which is recommended. (Win32)</p> </dd> <dt id="ioctl-FILEHANDLE,FUNCTION,SCALAR"><a class="permalink" href="#ioctl-FILEHANDLE,FUNCTION,SCALAR">#</a><a id="ioctl"></a><a id="ioctl-FILEHANDLE-FUNCTION-SCALAR"></a>ioctl FILEHANDLE,FUNCTION,SCALAR</dt> <dd> <p>Not implemented. (VMS)</p> <p>Available only for socket handles, and it does what the ioctlsocket() call in the Winsock API does. (Win32)</p> </dd> <dt id="kill-LIST"><a class="permalink" href="#kill-LIST">#</a><a id="kill"></a>kill LIST</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>)</p> <p>Available only for process handles returned by the <code>system(1, ...)</code> method of spawning a process. (Win32)</p> </dd> <dt id="link-OLDFILE,NEWFILE"><a class="permalink" href="#link-OLDFILE,NEWFILE">#</a><a id="link"></a><a id="link-OLDFILE-NEWFILE"></a>link OLDFILE,NEWFILE</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>, Win32, VMS)</p> </dd> <dt id="lstat-FILEHANDLE"><a class="permalink" href="#lstat-FILEHANDLE">#</a><a id="lstat1"></a>lstat FILEHANDLE</dt> <dd> </dd> <dt id="lstat-EXPR"><a class="permalink" href="#lstat-EXPR">#</a><a id="lstat2"></a>lstat EXPR</dt> <dd> </dd> <dt id="lstat"><a class="permalink" href="#lstat">#</a>lstat</dt> <dd> <p>Not implemented. (VMS)</p> <p>Return values may be bogus. (Win32)</p> </dd> <dt id="msgctl-ID,CMD,ARG"><a class="permalink" href="#msgctl-ID,CMD,ARG">#</a><a id="msgctl"></a><a id="msgctl-ID-CMD-ARG"></a>msgctl ID,CMD,ARG</dt> <dd> </dd> <dt id="msgget-KEY,FLAGS"><a class="permalink" href="#msgget-KEY,FLAGS">#</a><a id="msgget"></a><a id="msgget-KEY-FLAGS"></a>msgget KEY,FLAGS</dt> <dd> </dd> <dt id="msgsnd-ID,MSG,FLAGS"><a class="permalink" href="#msgsnd-ID,MSG,FLAGS">#</a><a id="msgsnd"></a><a id="msgsnd-ID-MSG-FLAGS"></a>msgsnd ID,MSG,FLAGS</dt> <dd> </dd> <dt id="msgrcv-ID,VAR,SIZE,TYPE,FLAGS"><a class="permalink" href="#msgrcv-ID,VAR,SIZE,TYPE,FLAGS">#</a><a id="msgrcv"></a><a id="msgrcv-ID-VAR-SIZE-TYPE-FLAGS"></a>msgrcv ID,VAR,SIZE,TYPE,FLAGS</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>, Win32, VMS, Plan9)</p> </dd> <dt id="open-FILEHANDLE,EXPR"><a class="permalink" href="#open-FILEHANDLE,EXPR">#</a><a id="open"></a><a id="open-FILEHANDLE-EXPR"></a>open FILEHANDLE,EXPR</dt> <dd> </dd> <dt id="open-FILEHANDLE"><a class="permalink" href="#open-FILEHANDLE">#</a><a id="open1"></a>open FILEHANDLE</dt> <dd> <p>The <code>|</code> variants are only supported if ToolServer is installed. (<span style="white-space: nowrap;">Mac OS</span>)</p> <p>open to <code>|-</code> and <code>-|</code> are unsupported. (<span style="white-space: nowrap;">Mac OS</span>, Win32)</p> </dd> <dt id="pipe-READHANDLE,WRITEHANDLE"><a class="permalink" href="#pipe-READHANDLE,WRITEHANDLE">#</a><a id="pipe"></a><a id="pipe-READHANDLE-WRITEHANDLE"></a>pipe READHANDLE,WRITEHANDLE</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>)</p> </dd> <dt id="readlink-EXPR"><a class="permalink" href="#readlink-EXPR">#</a><a id="readlink1"></a>readlink EXPR</dt> <dd> </dd> <dt id="readlink"><a class="permalink" href="#readlink">#</a>readlink</dt> <dd> <p>Not implemented. (Win32, VMS)</p> </dd> <dt id="select-RBITS,WBITS,EBITS,TIMEOUT"><a class="permalink" href="#select-RBITS,WBITS,EBITS,TIMEOUT">#</a><a id="select"></a><a id="select-RBITS-WBITS-EBITS-TIMEOUT"></a>select RBITS,WBITS,EBITS,TIMEOUT</dt> <dd> <p>Only implemented on sockets. (Win32)</p> </dd> <dt id="semctl-ID,SEMNUM,CMD,ARG"><a class="permalink" href="#semctl-ID,SEMNUM,CMD,ARG">#</a><a id="semctl"></a><a id="semctl-ID-SEMNUM-CMD-ARG"></a>semctl ID,SEMNUM,CMD,ARG</dt> <dd> </dd> <dt id="semget-KEY,NSEMS,FLAGS"><a class="permalink" href="#semget-KEY,NSEMS,FLAGS">#</a><a id="semget"></a><a id="semget-KEY-NSEMS-FLAGS"></a>semget KEY,NSEMS,FLAGS</dt> <dd> </dd> <dt id="semop-KEY,OPSTRING"><a class="permalink" href="#semop-KEY,OPSTRING">#</a><a id="semop"></a><a id="semop-KEY-OPSTRING"></a>semop KEY,OPSTRING</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>, Win32, VMS)</p> </dd> <dt id="setpgrp-PID,PGRP"><a class="permalink" href="#setpgrp-PID,PGRP">#</a><a id="setpgrp"></a><a id="setpgrp-PID-PGRP"></a>setpgrp PID,PGRP</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>, Win32, VMS)</p> </dd> <dt id="setpriority-WHICH,WHO,PRIORITY"><a class="permalink" href="#setpriority-WHICH,WHO,PRIORITY">#</a><a id="setpriority"></a><a id="setpriority-WHICH-WHO-PRIORITY"></a>setpriority WHICH,WHO,PRIORITY</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>, Win32, VMS)</p> </dd> <dt id="setsockopt-SOCKET,LEVEL,OPTNAME,OPTVAL"><a class="permalink" href="#setsockopt-SOCKET,LEVEL,OPTNAME,OPTVAL">#</a><a id="setsockopt"></a><a id="setsockopt-SOCKET-LEVEL-OPTNAME-OPTVAL"></a>setsockopt SOCKET,LEVEL,OPTNAME,OPTVAL</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>, Plan9)</p> </dd> <dt id="shmctl-ID,CMD,ARG"><a class="permalink" href="#shmctl-ID,CMD,ARG">#</a><a id="shmctl"></a><a id="shmctl-ID-CMD-ARG"></a>shmctl ID,CMD,ARG</dt> <dd> </dd> <dt id="shmget-KEY,SIZE,FLAGS"><a class="permalink" href="#shmget-KEY,SIZE,FLAGS">#</a><a id="shmget"></a><a id="shmget-KEY-SIZE-FLAGS"></a>shmget KEY,SIZE,FLAGS</dt> <dd> </dd> <dt id="shmread-ID,VAR,POS,SIZE"><a class="permalink" href="#shmread-ID,VAR,POS,SIZE">#</a><a id="shmread"></a><a id="shmread-ID-VAR-POS-SIZE"></a>shmread ID,VAR,POS,SIZE</dt> <dd> </dd> <dt id="shmwrite-ID,STRING,POS,SIZE"><a class="permalink" href="#shmwrite-ID,STRING,POS,SIZE">#</a><a id="shmwrite"></a><a id="shmwrite-ID-STRING-POS-SIZE"></a>shmwrite ID,STRING,POS,SIZE</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>, Win32, VMS)</p> </dd> <dt id="socketpair-SOCKET1,SOCKET2,DOMAIN,TYPE,PROTOCOL"><a class="permalink" href="#socketpair-SOCKET1,SOCKET2,DOMAIN,TYPE,PROTOCOL">#</a><a id="socketpair"></a><a id="socketpair-SOCKET1-SOCKET2-DOMAIN-TYPE-PROTOCOL"></a>socketpair SOCKET1,SOCKET2,DOMAIN,TYPE,PROTOCOL</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>, Win32, VMS)</p> </dd> <dt id="stat-FILEHANDLE"><a class="permalink" href="#stat-FILEHANDLE">#</a><a id="stat1"></a>stat FILEHANDLE</dt> <dd> </dd> <dt id="stat-EXPR"><a class="permalink" href="#stat-EXPR">#</a><a id="stat2"></a>stat EXPR</dt> <dd> </dd> <dt id="stat"><a class="permalink" href="#stat">#</a>stat</dt> <dd> <p>mtime and atime are the same thing, and ctime is creation time instead of inode change time. (<span style="white-space: nowrap;">Mac OS</span>)</p> <p>device and inode are not meaningful. (Win32)</p> <p>device and inode are not necessarily reliable. (VMS)</p> </dd> <dt id="symlink-OLDFILE,NEWFILE"><a class="permalink" href="#symlink-OLDFILE,NEWFILE">#</a><a id="symlink"></a><a id="symlink-OLDFILE-NEWFILE"></a>symlink OLDFILE,NEWFILE</dt> <dd> <p>Not implemented. (Win32, VMS)</p> </dd> <dt id="syscall-LIST"><a class="permalink" href="#syscall-LIST">#</a><a id="syscall"></a>syscall LIST</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>, Win32, VMS)</p> </dd> <dt id="system-LIST"><a class="permalink" href="#system-LIST">#</a><a id="system"></a>system LIST</dt> <dd> <p>Only implemented if ToolServer is installed. (<span style="white-space: nowrap;">Mac OS</span>)</p> <p>As an optimization, may not call the command shell specified in <code>$ENV{PERL5SHELL}</code>. <code>system(1, @args)</code> spawns an external process and immediately returns its process designator, without waiting for it to terminate. Return value may be used subsequently in <code>wait</code> or <code>waitpid</code>. (Win32)</p> </dd> <dt id="times"><a class="permalink" href="#times">#</a>times</dt> <dd> <p>Only the first entry returned is nonzero. (<span style="white-space: nowrap;">Mac OS</span>)</p> <p>"cumulative" times will be bogus. On anything other than Windows NT, "system" time will be bogus, and "user" time is actually the time returned by the clock() function in the C runtime library. (Win32)</p> </dd> <dt id="truncate-FILEHANDLE,LENGTH"><a class="permalink" href="#truncate-FILEHANDLE,LENGTH">#</a><a id="truncate"></a><a id="truncate-FILEHANDLE-LENGTH"></a>truncate FILEHANDLE,LENGTH</dt> <dd> </dd> <dt id="truncate-EXPR,LENGTH"><a class="permalink" href="#truncate-EXPR,LENGTH">#</a><a id="truncate1"></a><a id="truncate-EXPR-LENGTH"></a>truncate EXPR,LENGTH</dt> <dd> <p>Not implemented. (VMS)</p> </dd> <dt id="umask-EXPR"><a class="permalink" href="#umask-EXPR">#</a><a id="umask1"></a>umask EXPR</dt> <dd> </dd> <dt id="umask"><a class="permalink" href="#umask">#</a>umask</dt> <dd> <p>Returns undef where unavailable, as of version 5.005.</p> </dd> <dt id="utime-LIST"><a class="permalink" href="#utime-LIST">#</a><a id="utime"></a>utime LIST</dt> <dd> <p>Only the modification time is updated. (<span style="white-space: nowrap;">Mac OS</span>, VMS)</p> <p>May not behave as expected. (Win32)</p> </dd> <dt id="wait"><a class="permalink" href="#wait">#</a>wait</dt> <dd> </dd> <dt id="waitpid-PID,FLAGS"><a class="permalink" href="#waitpid-PID,FLAGS">#</a><a id="waitpid"></a><a id="waitpid-PID-FLAGS"></a>waitpid PID,FLAGS</dt> <dd> <p>Not implemented. (<span style="white-space: nowrap;">Mac OS</span>)</p> <p>Can only be applied to process handles returned for processes spawned using <code>system(1, ...)</code>. (Win32)</p> </dd> </dl> <h1 id="AUTHORS-/-CONTRIBUTORS"><a class="permalink" href="#AUTHORS-/-CONTRIBUTORS">#</a><a id="AUTHORS"></a><a id="AUTHORS-CONTRIBUTORS"></a>AUTHORS / CONTRIBUTORS</h1> <p>Chris Nandor <pudge@pobox.com>, Gurusamy Sarathy <gsar@umich.edu>, Peter Prymmer <pvhp@forte.com>, Tom Christiansen <tchrist@perl.com>, Nathan Torkington <gnat@frii.com>, Paul Moore <Paul.Moore@uk.origin-it.com>, Matthias Neercher <neeri@iis.ee.ethz.ch>, Charles Bailey <bailey@genetics.upenn.edu>, Luther Huffman <lutherh@stratcom.com>, Gary Ng <71564.1743@CompuServe.COM>, Nick Ing-Simmons <nick@ni-s.u-net.com>, Paul J. Schinder <schinder@pobox.com>, Tom Phoenix <rootbeer@teleport.com>, Hugo van der Sanden <h.sanden@elsevier.nl>, Dominic Dunlop <domo@vo.lu>, Dan Sugalski <sugalskd@ous.edu>, Andreas J. Koenig <koenig@kulturbox.de>, Andrew M. Langmead <aml@world.std.com>, Andy Dougherty <doughera@lafcol.lafayette.edu>, Abigail <abigail@fnx.com>.</p> <p>This document is maintained by Chris Nandor.</p> <h1 id="VERSION"><a class="permalink" href="#VERSION">#</a>VERSION</h1> <p>Version 1.23, last modified 10 July 1998.</p> </div> <div id="footer"> <p>Perldoc Browser is maintained by Dan Book (<a href="https://metacpan.org/author/DBOOK">DBOOK</a>). Please contact him via the <a href="https://github.com/Grinnz/perldoc-browser/issues">GitHub issue tracker</a> or <a href="mailto:dbook@cpan.org">email</a> regarding any issues with the site itself, search, or rendering of documentation.</p> <p>The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via the <a href="https://github.com/Perl/perl5/issues">Perl issue tracker</a>, the <a href="https://lists.perl.org/list/perl5-porters.html">mailing list</a>, or <a href="https://kiwiirc.com/client/irc.perl.org/p5p">IRC</a> to report any issues with the contents or format of the documentation.</p> </div> </div> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js" integrity="sha512-/DXTXr6nQodMUiq+IUJYCt2PPOUjrHJ9wFrqpJ3XkgPNOZVfMok7cRw6CSxyCQxXn6ozlESsSh1/sMCTF1rL/g==" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.1/umd/popper.min.js" integrity="sha512-ubuT8Z88WxezgSqf3RLuNi5lmjstiJcyezx34yIU2gAHonIi27Na7atqzUZCOoY4CExaoFumzOsFQ2Ch+I/HCw==" crossorigin="anonymous"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script> <script src="/js/highlight.pack.js"></script> <script>hljs.highlightAll();</script> </body> </html>