⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 perlport.pod

📁 ARM上的如果你对底层感兴趣
💻 POD
📖 第 1 页 / 共 4 页
字号:
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).

As of R2.5 of USS for OS/390 that Unix sub-system did not support the
C<#!> shebang trick for script invocation.  Hence, on OS/390 perl scripts
can executed with a header similar to the following simple script:

    : # 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";

On these platforms, bear in mind that the EBCDIC character set may have
an effect on what happens with some perl functions (such as C<chr>,
C<pack>, C<print>, C<printf>, C<ord>, C<sort>, C<sprintf>, C<unpack>), as
well as bit-fiddling with ASCII constants using operators like C<^>, C<&>
and C<|>, not to mention dealing with socket interfaces to ASCII computers
(see L<"NEWLINES">).

Fortunately, most web servers for the mainframe will correctly translate
the C<\n> in the following statement to its ASCII equivalent (note that
C<\r> is the same under both Unix and OS/390):

    print "Content-type: text/html\r\n\r\n";

The value of C<$^O> on OS/390 is "os390".

Some simple tricks for determining if you are running on an EBCDIC
platform could include any of the following (perhaps all):

    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"; }

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).

Also see:

=over 4

=item perl-mvs list

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.

=item AS/400 Perl information at C<http://as400.rochester.ibm.com/>

=back


=head2 Acorn RISC OS

As Acorns use ASCII with newlines (C<\n>) in text files as C<\012> like
Unix and Unix filename emulation is turned on by default, it is quite
likely that most simple scripts will work "out of the box".  The native
filing system is modular, and individual filing systems are free to be
case-sensitive or insensitive, and are usually case-preserving.  Some
native filing systems have name length limits which file and directory
names are silently truncated to fit - scripts should be aware that the
standard disc filing system currently has a name length limit of B<10>
characters, with up to 77 items in a directory, but other filing systems
may not impose such limitations.

Native filenames are of the form

    Filesystem#Special_Field::DiscName.$.Directory.Directory.File

where

    Special_Field is not usually present, but may contain . and $ .
    Filesystem =~ m|[A-Za-z0-9_]|
    DsicName   =~ m|[A-Za-z0-9_/]|
    $ represents the root directory
    . is the path separator
    @ is the current directory (per filesystem but machine global)
    ^ is the parent directory
    Directory and File =~ m|[^\0- "\.\$\%\&:\@\\^\|\177]+|

The default filename translation is roughly C<tr|/.|./|;>

Note that C<"ADFS::HardDisc.$.File" ne 'ADFS::HardDisc.$.File'> and that
the second stage of C<$> interpolation in regular expressions will fall
foul of the C<$.> if scripts are not careful.

Logical paths specified by system variables containing comma-separated
search lists are also allowed, hence C<System:Modules> is a valid
filename, and the filesystem will prefix C<Modules> with each section of
C<System$Path> until a name is made that points to an object on disc.
Writing to a new file C<System:Modules> would only be allowed if
C<System$Path> contains a single item list.  The filesystem will also
expand system variables in filenames if enclosed in angle brackets, so
C<E<lt>System$DirE<gt>.Modules> would look for the file
S<C<$ENV{'System$Dir'} . 'Modules'>>.  The obvious implication of this is
that B<fully qualified filenames can start with C<E<lt>E<gt>> and should
be protected when C<open> is used for input.

Because C<.> was in use as a directory separator and filenames could not
be assumed to be unique after 10 characters, Acorn implemented the C
compiler to strip the trailing C<.c> C<.h> C<.s> and C<.o> suffix from
filenames specified in source code and store the respective files in
subdirectories named after the suffix. Hence files are translated:

    foo.h           h.foo
    C:foo.h         C:h.foo        (logical path variable)
    sys/os.h        sys.h.os       (C compiler groks Unix-speak)
    10charname.c    c.10charname
    10charname.o    o.10charname
    11charname_.c   c.11charname   (assuming filesystem truncates at 10)

The Unix emulation library's translation of filenames to native assumes
that this sort of translation is required, and allows a user defined list
of known suffixes which it will transpose in this fashion.  This may
appear transparent, but consider that with these rules C<foo/bar/baz.h>
and C<foo/bar/h/baz> both map to C<foo.bar.h.baz>, and that C<readdir> and
C<glob> cannot and do not attempt to emulate the reverse mapping.  Other
C<.>s in filenames are translated to C</>.

As implied above the environment accessed through C<%ENV> is global, and
the convention is that program specific environment variables are of the
form C<Program$Name>.  Each filing system maintains a current directory,
and the current filing system's current directory is the B<global> current
directory.  Consequently, sociable scripts don't change the current
directory but rely on full pathnames, and scripts (and Makefiles) cannot
assume that they can spawn a child process which can change the current
directory without affecting its parent (and everyone else for that
matter).

As native operating system filehandles are global and currently are
allocated down from 255, with 0 being a reserved value the Unix emulation
library emulates Unix filehandles.  Consequently, you can't rely on
passing C<STDIN>, C<STDOUT>, or C<STDERR> to your children.

The desire of users to express filenames of the form
C<E<lt>Foo$DirE<gt>.Bar> on the command line unquoted causes problems,
too: C<``> command output capture has to perform a guessing game.  It
assumes that a string C<E<lt>[^E<lt>E<gt>]+\$[^E<lt>E<gt>]E<gt>> is a
reference to an environment variable, whereas anything else involving
C<E<lt>> or C<E<gt>> is redirection, and generally manages to be 99%
right.  Of course, the problem remains that scripts cannot rely on any
Unix tools being available, or that any tools found have Unix-like command
line arguments.

Extensions and XS are, in theory, buildable by anyone using free tools.
In practice, many don't, as users of the Acorn platform are used to binary
distribution.  MakeMaker does run, but no available make currently copes
with MakeMaker's makefiles; even if/when this is fixed, the lack of a
Unix-like shell can cause problems with makefile rules, especially lines
of the form C<cd sdbm && make all>, and anything using quoting.

"S<RISC OS>" is the proper name for the operating system, but the value
in C<$^O> is "riscos" (because we don't like shouting).

Also see:

=over 4

=item perl list

=back


=head2 Other perls

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 F<ports/> directory on CPAN for information, and possibly
binaries, for the likes of: aos, atari, lynxos, riscos, Tandem Guardian,
vos, I<etc.> (yes we know that some of these OSes may fall under the Unix
category, but we are not a standards body.)

See also:

=over 4

=item Atari, Guido Flohr's page C<http://stud.uni-sb.de/~gufl0000/>

=item HP 300 MPE/iX  C<http://www.cccd.edu/~markb/perlix.html>

=item Novell Netware

A free perl5-based PERL.NLM for Novell Netware is available from
C<http://www.novell.com/>

=back


=head1 FUNCTION IMPLEMENTATIONS

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.

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.

Be aware, moreover, that even among Unix-ish systems there are variations.

For many functions, you can also query C<%Config>, exported by default
from C<Config.pm>.  For example, to check if the platform has the C<lstat>
call, check C<$Config{'d_lstat'}>.  See L<Config.pm> for a full
description of available variables.


=head2 Alphabetical Listing of Perl Functions

=over 8

=item -X FILEHANDLE

=item -X EXPR

=item -X

C<-r>, C<-w>, and C<-x> have only a very limited meaning; directories
and applications are executable, and there are no uid/gid
considerations. C<-o> is not supported. (S<Mac OS>)

C<-r>, C<-w>, C<-x>, and C<-o> tell whether or not file is accessible,
which may not reflect UIC-based file protections. (VMS)

C<-s> returns the size of the data fork, not the total size of data fork
plus resource fork.  (S<Mac OS>).

C<-s> by name on an open file will return the space reserved on disk,
rather than the current extent.  C<-s> on an open filehandle returns the
current size. (S<RISC OS>)

C<-R>, C<-W>, C<-X>, C<-O> are indistinguishable from C<-r>, C<-w>,
C<-x>, C<-o>. (S<Mac OS>, Win32, VMS, S<RISC OS>)

C<-b>, C<-c>, C<-k>, C<-g>, C<-p>, C<-u>, C<-A> are not implemented.
(S<Mac OS>)

C<-g>, C<-k>, C<-l>, C<-p>, C<-u>, C<-A> are not particularly meaningful.
(Win32, VMS, S<RISC OS>)

C<-d> is true if passed a device spec without an explicit directory.
(VMS)

C<-T> and C<-B> are implemented, but might misclassify Mac text files
with foreign characters; this is the case will all platforms, but may
affect S<Mac OS> often. (S<Mac OS>)

C<-x> (or C<-X>) determine if a file ends in one of the executable
suffixes. C<-S> is meaningless. (Win32)

C<-x> (or C<-X>) determine if a file has an executable file type.
(S<RISC OS>)

=item binmode FILEHANDLE

Meaningless. (S<Mac OS>, S<RISC OS>)

Reopens file and restores pointer; if function fails, underlying
filehandle may be closed, or pointer may be in a different position.
(VMS)

The value returned by C<tell> may be affected after the call, and
the filehandle may be flushed. (Win32)

=item chmod LIST

Only limited meaning. Disabling/enabling write permission is mapped to
locking/unlocking the file. (S<Mac OS>)

Only good for changing "owner" read-write access, "group", and "other"
bits are meaningless. (Win32)

Only good for changing "owner" and "other" read-write access. (S<RISC OS>)

=item chown LIST

Not implemented. (S<Mac OS>, Win32, Plan9, S<RISC OS>)

Does nothing, but won't fail. (Win32)

=item chroot FILENAME

=item chroot

Not implemented. (S<Mac OS>, Win32, VMS, Plan9, S<RISC OS>)

=item crypt PLAINTEXT,SALT

May not be available if library or source was not provided when building
perl. (Win32)

=item dbmclose HASH

Not implemented. (VMS, Plan9)

=item dbmopen HASH,DBNAME,MODE

Not implemented. (VMS, Plan9)

=item dump LABEL

Not useful. (S<Mac OS>, S<RISC OS>)

Not implemented. (Win32)

Invokes VMS debugger. (VMS)

=item exec LIST

Not implemented. (S<Mac OS>)

=item fcntl FILEHANDLE,FUNCTION,SCALAR

Not implemented. (Win32, VMS)

=item flock FILEHANDLE,OPERATION

Not implemented (S<Mac OS>, VMS, S<RISC OS>).

Available only on Windows NT (not on Windows 95). (Win32)

=item fork

Not implemented. (S<Mac OS>, Win32, AmigaOS, S<RISC OS>)

=item getlogin

Not implemented. (S<Mac OS>, S<RISC OS>)

=item getpgrp PID

Not implemented. (S<Mac OS>, Win32, VMS, S<RISC OS>)

=item getppid

Not implemented. (S<Mac OS>, Win32, VMS, S<RISC OS>)

=item getpriority WHICH,WHO

Not implemented. (S<Mac OS>, Win32, VMS, S<RISC OS>)

=item getpwnam NAME

Not implemented. (S<Mac OS>, Win32)

Not useful. (S<RISC OS>)

=item getgrnam NAME

Not implemented. (S<Mac OS>, Win32, VMS, S<RISC OS>)

=item getnetbyname NAME

Not implemented. (S<Mac OS>, Win32, Plan9)

=item getpwuid UID

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -