📄 perlport.1
字号:
.Ve.PPA MacPerl script saved as a \*(L"droplet\*(R" will populate \f(CW@ARGV\fR with the fullpathnames of the files dropped onto the script..PPMac users can run programs under a type of command line interfaceunder \s-1MPW\s0 (Macintosh Programmer's Workshop, a free developmentenvironment from Apple). MacPerl was first introduced as an \s-1MPW\s0tool, and \s-1MPW\s0 can be used like a shell:.PP.Vb 1\& perl myscript.plx some arguments.Ve.PPToolServer is another app from Apple that provides access to \s-1MPW\s0 toolsfrom \s-1MPW\s0 and the MacPerl app, which allows MacPerl programs to use\&\f(CW\*(C`system\*(C'\fR, backticks, and piped \f(CW\*(C`open\*(C'\fR..PP\&\*(L"Mac\ \s-1OS\s0\*(R" is the proper name for the operating system, but the valuein \f(CW$^O\fR is \*(L"MacOS\*(R". To determine architecture, version, or whetherthe application or \s-1MPW\s0 tool version is running, check:.PP.Vb 5\& $is_app = $MacPerl::Version =~ /App/;\& $is_tool = $MacPerl::Version =~ /MPW/;\& ($version) = $MacPerl::Version =~ /^(\eS+)/;\& $is_ppc = $MacPerl::Architecture eq \*(AqMacPPC\*(Aq;\& $is_68k = $MacPerl::Architecture eq \*(AqMac68K\*(Aq;.Ve.PPMac\ \s-1OS\s0\ X, based on NeXT's OpenStep \s-1OS\s0, runs MacPerl natively, under the\&\*(L"Classic\*(R" environment. There is no \*(L"Carbon\*(R" version of MacPerl to rununder the primary Mac \s-1OS\s0 X environment. Mac\ \s-1OS\s0\ X and its Open Sourceversion, Darwin, both run Unix perl natively..PPAlso see:.IP "\(bu" 4MacPerl Development, http://dev.macperl.org/ ..IP "\(bu" 4The MacPerl Pages, http://www.macperl.com/ ..IP "\(bu" 4The MacPerl mailing lists, http://lists.perl.org/ ..IP "\(bu" 4\&\s-1MPW\s0, ftp://ftp.apple.com/developer/Tool_Chest/Core_Mac_OS_Tools/.Sh "\s-1VMS\s0".IX Subsection "VMS"Perl on \s-1VMS\s0 is discussed in perlvms in the perl distribution..PPThe official name of \s-1VMS\s0 as of this writing is OpenVMS..PPPerl on \s-1VMS\s0 can accept either \s-1VMS\-\s0 or Unix-style filespecifications as in either of the following:.PP.Vb 2\& $ perl \-ne "print if /perl_setup/i" SYS$LOGIN:LOGIN.COM\& $ perl \-ne "print if /perl_setup/i" /sys$login/login.com.Ve.PPbut not a mixture of both as in:.PP.Vb 2\& $ perl \-ne "print if /perl_setup/i" sys$login:/login.com\& Can\*(Aqt open sys$login:/login.com: file specification syntax error.Ve.PPInteracting with Perl from the Digital Command Language (\s-1DCL\s0) shelloften requires a different set of quotation marks than Unix shells do.For example:.PP.Vb 2\& $ perl \-e "print ""Hello, world.\en"""\& Hello, world..Ve.PPThere are several ways to wrap your perl scripts in \s-1DCL\s0 \fI.COM\fR files, ifyou are so inclined. For example:.PP.Vb 6\& $ write sys$output "Hello from DCL!"\& $ if p1 .eqs. ""\& $ then perl \-x \*(Aqf$environment("PROCEDURE")\& $ else perl \-x \- \*(Aqp1 \*(Aqp2 \*(Aqp3 \*(Aqp4 \*(Aqp5 \*(Aqp6 \*(Aqp7 \*(Aqp8\& $ deck/dollars="_\|_END_\|_"\& #!/usr/bin/perl\&\& print "Hello from Perl!\en";\&\& _\|_END_\|_\& $ endif.Ve.PPDo take care with \f(CW\*(C`$ ASSIGN/nolog/user SYS$COMMAND: SYS$INPUT\*(C'\fR if yourperl-in-DCL script expects to do things like \f(CW\*(C`$read = <STDIN>;\*(C'\fR..PPThe \s-1VMS\s0 operating system has two filesystems, known as \s-1ODS\-2\s0 and \s-1ODS\-5\s0..PPFor \s-1ODS\-2\s0, filenames are in the format \*(L"name.extension;version\*(R". Themaximum length for filenames is 39 characters, and the maximum length forextensions is also 39 characters. Version is a number from 1 to32767. Valid characters are \f(CW\*(C`/[A\-Z0\-9$_\-]/\*(C'\fR..PPThe \s-1ODS\-2\s0 filesystem is case-insensitive and does not preserve case.Perl simulates this by converting all filenames to lowercase internally..PPFor \s-1ODS\-5\s0, filenames may have almost any character in them and can includeUnicode characters. Characters that could be misinterpreted by the \s-1DCL\s0shell or file parsing utilities need to be prefixed with the \f(CW\*(C`^\*(C'\fRcharacter, or replaced with hexadecimal characters prefixed with the\&\f(CW\*(C`^\*(C'\fR character. Such prefixing is only needed with the pathnames arein \s-1VMS\s0 format in applications. Programs that can accept the \s-1UNIX\s0 formatof pathnames do not need the escape characters. The maximum length forfilenames is 255 characters. The \s-1ODS\-5\s0 file system can handle botha case preserved and a case sensitive mode..PP\&\s-1ODS\-5\s0 is only available on the OpenVMS for 64 bit platforms..PPSupport for the extended file specifications is being done as optionalsettings to preserve backward compatibility with Perl scripts thatassume the previous \s-1VMS\s0 limitations..PPIn general routines on \s-1VMS\s0 that get a \s-1UNIX\s0 format file specificationshould return it in a \s-1UNIX\s0 format, and when they get a \s-1VMS\s0 formatspecification they should return a \s-1VMS\s0 format unless they are documentedto do a conversion..PPFor routines that generate return a file specification, \s-1VMS\s0 allows settingif the C library which Perl is built on if it will be returned in \s-1VMS\s0format or in \s-1UNIX\s0 format..PPWith the \s-1ODS\-2\s0 file system, there is not much difference in syntax offilenames without paths for \s-1VMS\s0 or \s-1UNIX\s0. With the extended characterset available with \s-1ODS\-5\s0 there can be a significant difference..PPBecause of this, existing Perl scripts written for \s-1VMS\s0 were sometimestreating \s-1VMS\s0 and \s-1UNIX\s0 filenames interchangeably. Without the extendedcharacter set enabled, this behavior will mostly be maintained forbackwards compatibility..PPWhen extended characters are enabled with \s-1ODS\-5\s0, the handling of\&\s-1UNIX\s0 formatted file specifications is to that of a \s-1UNIX\s0 system..PP\&\s-1VMS\s0 file specifications without extensions have a trailing dot. Anequivalent \s-1UNIX\s0 file specification should not show the trailing dot..PPThe result of all of this, is that for \s-1VMS\s0, for portable scripts, youcan not depend on Perl to present the filenames in lowercase, to becase sensitive, and that the filenames could be returned in either\&\s-1UNIX\s0 or \s-1VMS\s0 format..PPAnd if a routine returns a file specification, unless it is intended toconvert it, it should return it in the same format as it found it..PP\&\f(CW\*(C`readdir\*(C'\fR by default has traditionally returned lowercased filenames.When the \s-1ODS\-5\s0 support is enabled, it will return the exact case of thefilename on the disk..PPFiles without extensions have a trailing period on them, so doing a\&\f(CW\*(C`readdir\*(C'\fR in the default mode with a file named \fIA.;5\fR willreturn \fIa.\fR when \s-1VMS\s0 is (though that file could be opened with\&\f(CW\*(C`open(FH, \*(AqA\*(Aq)\*(C'\fR)..PPWith support for extended file specifications and if \f(CW\*(C`opendir\*(C'\fR wasgiven a \s-1UNIX\s0 format directory, a file named \fIA.;5\fR will return \fIa\fRand optionally in the exact case on the disk. When \f(CW\*(C`opendir\*(C'\fR is givena \s-1VMS\s0 format directory, then \f(CW\*(C`readdir\*(C'\fR should return \fIa.\fR, andagain with the optionally the exact case..PP\&\s-1RMS\s0 had an eight level limit on directory depths from any rooted logical(allowing 16 levels overall) prior to \s-1VMS\s0 7.2, and even with versions of\&\s-1VMS\s0 on \s-1VAX\s0 up through 7.3. Hence \f(CW\*(C`PERL_ROOT:[LIB.2.3.4.5.6.7.8]\*(C'\fR is avalid directory specification but \f(CW\*(C`PERL_ROOT:[LIB.2.3.4.5.6.7.8.9]\*(C'\fR isnot. \fIMakefile.PL\fR authors might have to take this into account, but atleast they can refer to the former as \f(CW\*(C`/PERL_ROOT/lib/2/3/4/5/6/7/8/\*(C'\fR..PPPumpkings and module integrators can easily see whether files with too manydirectory levels have snuck into the core by running the following in thetop-level source directory:.PP.Vb 1\& $ perl \-ne "$_=~s/\es+.*//; print if scalar(split /\e//) > 8;" < MANIFEST.Ve.PPThe VMS::Filespec module, which gets installed as part of the buildprocess on \s-1VMS\s0, is a pure Perl module that can easily be installed onnon-VMS platforms and can be helpful for conversions to and from \s-1RMS\s0native formats. It is also now the only way that you should check tosee if \s-1VMS\s0 is in a case sensitive mode..PPWhat \f(CW\*(C`\en\*(C'\fR represents depends on the type of file opened. It usuallyrepresents \f(CW\*(C`\e012\*(C'\fR but it could also be \f(CW\*(C`\e015\*(C'\fR, \f(CW\*(C`\e012\*(C'\fR, \f(CW\*(C`\e015\e012\*(C'\fR, \&\f(CW\*(C`\e000\*(C'\fR, \f(CW\*(C`\e040\*(C'\fR, or nothing depending on the file organization and record format. The VMS::Stdio module provides access to the special \fIfopen()\fR requirements of files with unusual attributes on \s-1VMS\s0..PP\&\s-1TCP/IP\s0 stacks are optional on \s-1VMS\s0, so socket routines might not beimplemented. \s-1UDP\s0 sockets may not be supported..PPThe \s-1TCP/IP\s0 library support for all current versions of \s-1VMS\s0 is dynamicallyloaded if present, so even if the routines are configured, they mayreturn a status indicating that they are not implemented..PPThe value of \f(CW$^O\fR on OpenVMS is \*(L"\s-1VMS\s0\*(R". To determine the architecturethat you are running on without resorting to loading all of \f(CW%Config\fRyou can examine the content of the \f(CW@INC\fR array like so:.PP.Vb 2\& if (grep(/VMS_AXP/, @INC)) {\& print "I\*(Aqm on Alpha!\en";\&\& } elsif (grep(/VMS_VAX/, @INC)) {\& print "I\*(Aqm on VAX!\en";\&\& } elsif (grep(/VMS_IA64/, @INC)) {\& print "I\*(Aqm on IA64!\en";\&\& } else {\& print "I\*(Aqm not so sure about where $^O is...\en";\& }.Ve.PPIn general, the significant differences should only be if Perl is runningon \s-1VMS_VAX\s0 or one of the 64 bit OpenVMS platforms..PPOn \s-1VMS\s0, perl determines the \s-1UTC\s0 offset from the \f(CW\*(C`SYS$TIMEZONE_DIFFERENTIAL\*(C'\fRlogical name. Although the \s-1VMS\s0 epoch began at 17\-NOV\-1858 00:00:00.00,calls to \f(CW\*(C`localtime\*(C'\fR are adjusted to count offsets from01\-JAN\-1970 00:00:00.00, just like Unix..PPAlso see:.IP "\(bu" 4\&\fI\s-1README\s0.vms\fR (installed as README_vms), perlvms.IP "\(bu" 4vmsperl list, vmsperl\-subscribe@perl.org.IP "\(bu" 4vmsperl on the web, http://www.sidhe.org/vmsperl/index.html.Sh "\s-1VOS\s0".IX Subsection "VOS"Perl on \s-1VOS\s0 is discussed in \fI\s-1README\s0.vos\fR in the perl distribution(installed as perlvos). Perl on \s-1VOS\s0 can accept either \s-1VOS\-\s0 orUnix-style file specifications as in either of the following:.PP.Vb 2\& C<< $ perl \-ne "print if /perl_setup/i" >system>notices >>\& C<< $ perl \-ne "print if /perl_setup/i" /system/notices >>.Ve.PPor even a mixture of both as in:.PP.Vb 1\& C<< $ perl \-ne "print if /perl_setup/i" >system/notices >>.Ve.PPEven though \s-1VOS\s0 allows the slash character to appear in objectnames, because the \s-1VOS\s0 port of Perl interprets it as a pathnamedelimiting character, \s-1VOS\s0 files, directories, or links whose namescontain a slash character cannot be processed. Such files must berenamed before they can be processed by Perl. Note that \s-1VOS\s0 limitsfile names to 32 or fewer characters..PPThe value of \f(CW$^O\fR on \s-1VOS\s0 is \*(L"\s-1VOS\s0\*(R". To determine the architecture thatyou are running on without resorting to loading all of \f(CW%Config\fR youcan examine the content of the \f(CW@INC\fR array like so:.PP.Vb 6\& if ($^O =~ /VOS/) {\& print "I\*(Aqm on a Stratus box!\en";\& } else {\& print "I\*(Aqm not on a Stratus box!\en";\& die;\& }.Ve.PPAlso see:.IP "\(bu" 4\&\fI\s-1README\s0.vos\fR (installed as perlvos).IP "\(bu" 4The \s-1VOS\s0 mailing list..SpThere is no specific mailing list for Perl on \s-1VOS\s0. You can postcomments to the comp.sys.stratus newsgroup, or subscribe to the generalStratus mailing list. Send a letter with \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -