System Interaction
Platforms that rely on a graphical user interface sometimes lack command lines, so programs requiring a command-line interface might not work everywhere. You can’t do much about this except upgrade.
Some other tips:
Some platforms can’t delete or rename files that are in use, so remember to
closefiles when you are done with them. Don’tunlinkorrenamean open file. Don’ttieoropena file already tied or opened;untieorcloseit first.Don’t open the same file more than once at a time for writing, since some operating systems put mandatory locks on such files.
Don’t depend on a specific environment variable existing in
%ENV, and don’t assume that anything in%ENVwill be case-sensitive or case-preserving. Don’t assume Unix inheritance semantics for environment variables; on some systems, they may be visible to all other processes.Don’t use signals or
%SIG.Avoid filename globbing. Use
opendir,readdir, andclosedirinstead. (As of v5.6, basic filename globbing is much more portable than it was, but some systems may still chafe under the Unixisms of the default interface if you try to get fancy.)Don’t assume specific values of the error numbers or strings stored in
$!.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access