📄 perlvms.1
字号:
status value will have either one of the \f(CW$!\fR or \f(CW$?\fR or \f(CW$^E\fR orthe \s-1UNIX\s0 value 255 encoded into it in a way that the effective originalvalue can be decoded by other programs written in C, including Perland the \s-1GNV\s0 package. As per the normal non-VMS behavior of \f(CW\*(C`die\*(C'\fR ifeither \f(CW$!\fR or \f(CW$?\fR are non-zero, one of those values will beencoded into a native \s-1VMS\s0 status value. If both of the \s-1UNIX\s0 statusvalues are 0, and the \f(CW$^E\fR value is set one of \s-1ERROR\s0 or \s-1SEVERE_ERROR\s0severity, then the \f(CW$^E\fR value will be used as the exit code as is.If none of the above apply, the \s-1UNIX\s0 value of 255 will be encoded intoa native \s-1VMS\s0 exit status value..SpPlease note a significant difference in the behavior of \f(CW\*(C`die\*(C'\fR inthe future \s-1POSIX_EXIT\s0 mode is that it does not force a \s-1VMS\s0\&\s-1SEVERE_ERROR\s0 status on exit. The \s-1UNIX\s0 exit values of 2 through255 will be encoded in \s-1VMS\s0 status values with severity levels of\&\s-1SUCCESS\s0. The \s-1UNIX\s0 exit value of 1 will be encoded in a \s-1VMS\s0 statusvalue with a severity level of \s-1ERROR\s0. This is to be compatible withhow the \s-1VMS\s0 C library encodes these values..SpThe minimum severity level set by \f(CW\*(C`die\*(C'\fR in a future \s-1POSIX_EXIT\s0 modemay be changed to be \s-1ERROR\s0 or higher before that mode becomes fully activedepending on the results of testing and further review. If this isdone, the behavior of c<\s-1DIE\s0> in the future \s-1POSIX_EXIT\s0 will close enoughto the default mode that most \s-1DCL\s0 shell scripts will probably not noticea difference..SpSee \f(CW$?\fR for a description of the encoding of the \s-1UNIX\s0 value toproduce a native \s-1VMS\s0 status containing it..IP "dump" 4.IX Item "dump"Rather than causing Perl to abort and dump core, the \f(CW\*(C`dump\*(C'\fRoperator invokes the \s-1VMS\s0 debugger. If you continue toexecute the Perl program under the debugger, control willbe transferred to the label specified as the argument to\&\f(CW\*(C`dump\*(C'\fR, or, if no label was specified, back to thebeginning of the program. All other state of the program(\fIe.g.\fR values of variables, open file handles) are notaffected by calling \f(CW\*(C`dump\*(C'\fR..IP "exec \s-1LIST\s0" 4.IX Item "exec LIST"A call to \f(CW\*(C`exec\*(C'\fR will cause Perl to exit, and to invoke the commandgiven as an argument to \f(CW\*(C`exec\*(C'\fR via \f(CW\*(C`lib$do_command\*(C'\fR. If theargument begins with '@' or '$' (other than as part of a filespec),then it is executed as a \s-1DCL\s0 command. Otherwise, the first token onthe command line is treated as the filespec of an image to run, andan attempt is made to invoke it (using \fI.Exe\fR and the processdefaults to expand the filespec) and pass the rest of \f(CW\*(C`exec\*(C'\fR'sargument to it as parameters. If the token has no file type, andmatches a file with null type, then an attempt is made to determinewhether the file is an executable image which should be invokedusing \f(CW\*(C`MCR\*(C'\fR or a text file which should be passed to \s-1DCL\s0 as acommand procedure..IP "fork" 4.IX Item "fork"While in principle the \f(CW\*(C`fork\*(C'\fR operator could be implemented via(and with the same rather severe limitations as) the \s-1CRTL\s0 \f(CW\*(C`vfork()\*(C'\fRroutine, and while some internal support to do just that is inplace, the implementation has never been completed, making \f(CW\*(C`fork\*(C'\fRcurrently unavailable. A true kernel \f(CW\*(C`fork()\*(C'\fR is expected in afuture version of \s-1VMS\s0, and the pseudo-fork based on interpreterthreads may be available in a future version of Perl on \s-1VMS\s0 (seeperlfork). In the meantime, use \f(CW\*(C`system\*(C'\fR, backticks, or pipedfilehandles to create subprocesses..IP "getpwent" 4.IX Item "getpwent".PD 0.IP "getpwnam" 4.IX Item "getpwnam".IP "getpwuid" 4.IX Item "getpwuid".PDThese operators obtain the information described in perlfunc,if you have the privileges necessary to retrieve the named user's\&\s-1UAF\s0 information via \f(CW\*(C`sys$getuai\*(C'\fR. If not, then only the \f(CW$name\fR,\&\f(CW$uid\fR, and \f(CW$gid\fR items are returned. The \f(CW$dir\fR item containsthe login directory in \s-1VMS\s0 syntax, while the \f(CW$comment\fR itemcontains the login directory in Unix syntax. The \f(CW$gcos\fR itemcontains the owner field from the \s-1UAF\s0 record. The \f(CW$quota\fRitem is not used..IP "gmtime" 4.IX Item "gmtime"The \f(CW\*(C`gmtime\*(C'\fR operator will function properly if you have aworking \s-1CRTL\s0 \f(CW\*(C`gmtime()\*(C'\fR routine, or if the logical name\&\s-1SYS$TIMEZONE_DIFFERENTIAL\s0 is defined as the number of secondswhich must be added to \s-1UTC\s0 to yield local time. (This logicalname is defined automatically if you are running a version of\&\s-1VMS\s0 with built-in \s-1UTC\s0 support.) If neither of these cases istrue, a warning message is printed, and \f(CW\*(C`undef\*(C'\fR is returned..IP "kill" 4.IX Item "kill"In most cases, \f(CW\*(C`kill\*(C'\fR is implemented via the undocumented systemservice <$SIGPRC>, which has the same calling sequence as <$FORCEX>, butthrows an exception in the target process rather than forcing it to call\&\f(CW$EXIT\fR. Generally speaking, \f(CW\*(C`kill\*(C'\fR follows the behavior of the\&\s-1CRTL\s0's \f(CW\*(C`kill()\*(C'\fR function, but unlike that function can be called fromwithin a signal handler. Also, unlike the \f(CW\*(C`kill\*(C'\fR in some versions ofthe \s-1CRTL\s0, Perl's \f(CW\*(C`kill\*(C'\fR checks the validity of the signal passed in andreturns an error rather than attempting to send an unrecognized signal..SpAlso, negative signal values don't do anything special under\&\s-1VMS\s0; they're just converted to the corresponding positive value..IP "qx//" 4.IX Item "qx//"See the entry on \f(CW\*(C`backticks\*(C'\fR above..IP "select (system call)" 4.IX Item "select (system call)"If Perl was not built with socket support, the system callversion of \f(CW\*(C`select\*(C'\fR is not available at all. If socketsupport is present, then the system call version of\&\f(CW\*(C`select\*(C'\fR functions only for file descriptors attachedto sockets. It will not provide information about regularfiles or pipes, since the \s-1CRTL\s0 \f(CW\*(C`select()\*(C'\fR routine does notprovide this functionality..IP "stat \s-1EXPR\s0" 4.IX Item "stat EXPR"Since \s-1VMS\s0 keeps track of files according to a different schemethan Unix, it's not really possible to represent the file's \s-1ID\s0in the \f(CW\*(C`st_dev\*(C'\fR and \f(CW\*(C`st_ino\*(C'\fR fields of a \f(CW\*(C`struct stat\*(C'\fR. Perltries its best, though, and the values it uses are pretty unlikelyto be the same for two different files. We can't guarantee this,though, so caveat scriptor..IP "system \s-1LIST\s0" 4.IX Item "system LIST"The \f(CW\*(C`system\*(C'\fR operator creates a subprocess, and passes its arguments to the subprocess for execution as a \s-1DCL\s0 command. Since the subprocess is created directly via \f(CW\*(C`lib$spawn()\*(C'\fR, any valid \s-1DCL\s0 command string may be specified. If the string begins with\&'@', it is treated as a \s-1DCL\s0 command unconditionally. Otherwise, ifthe first token contains a character used as a delimiter in filespecification (e.g. \f(CW\*(C`:\*(C'\fR or \f(CW\*(C`]\*(C'\fR), an attempt is made to expand itusing a default type of \fI.Exe\fR and the process defaults, and ifsuccessful, the resulting file is invoked via \f(CW\*(C`MCR\*(C'\fR. This allows youto invoke an image directly simply by passing the file specificationto \f(CW\*(C`system\*(C'\fR, a common Unixish idiom. If the token has no file type,and matches a file with null type, then an attempt is made todetermine whether the file is an executable image which should beinvoked using \f(CW\*(C`MCR\*(C'\fR or a text file which should be passed to \s-1DCL\s0as a command procedure..SpIf \s-1LIST\s0 consists of the empty string, \f(CW\*(C`system\*(C'\fR spawns aninteractive \s-1DCL\s0 subprocess, in the same fashion as typing\&\fB\s-1SPAWN\s0\fR at the \s-1DCL\s0 prompt..SpPerl waits for the subprocess to complete before continuingexecution in the current process. As described in perlfunc,the return value of \f(CW\*(C`system\*(C'\fR is a fake \*(L"status\*(R" which follows\&\s-1POSIX\s0 semantics unless the pragma \f(CW\*(C`use vmsish \*(Aqstatus\*(Aq\*(C'\fR is ineffect; see the description of \f(CW$?\fR in this document for more detail..IP "time" 4.IX Item "time"The value returned by \f(CW\*(C`time\*(C'\fR is the offset in seconds from01\-JAN\-1970 00:00:00 (just like the \s-1CRTL\s0's \fItimes()\fR routine), in orderto make life easier for code coming in from the POSIX/Unix world..IP "times" 4.IX Item "times"The array returned by the \f(CW\*(C`times\*(C'\fR operator is divided up according to the same rules the \s-1CRTL\s0 \f(CW\*(C`times()\*(C'\fR routine. Therefore, the \*(L"system time\*(R" elements will always be 0, since there is no difference between \*(L"user time\*(R" and \*(L"system\*(R" time under \s-1VMS\s0, and the time accumulated by a subprocess may or may not appear separately in the \*(L"child time\*(R" field, depending on whether times keeps track of subprocesses separately. Noteespecially that the \s-1VAXCRTL\s0 (at least) keeps track only ofsubprocesses spawned using fork and exec; it will notaccumulate the times of subprocesses spawned via pipes, system,or backticks..IP "unlink \s-1LIST\s0" 4.IX Item "unlink LIST"\&\f(CW\*(C`unlink\*(C'\fR will delete the highest version of a file only; inorder to delete all versions, you need to say.Sp.Vb 1\& 1 while unlink LIST;.Ve.SpYou may need to make this change to scripts written for aUnix system which expect that after a call to \f(CW\*(C`unlink\*(C'\fR,no files with the names passed to \f(CW\*(C`unlink\*(C'\fR will exist.(Note: This can be changed at compile time; if you\&\f(CW\*(C`use Config\*(C'\fR and \f(CW$Config{\*(Aqd_unlink_all_versions\*(Aq}\fR is\&\f(CW\*(C`define\*(C'\fR, then \f(CW\*(C`unlink\*(C'\fR will delete all versions of afile on the first call.).Sp\&\f(CW\*(C`unlink\*(C'\fR will delete a file if at all possible, even if itrequires changing file protection (though it won't try tochange the protection of the parent directory). You can tellwhether you've got explicit delete access to a file by using the\&\f(CW\*(C`VMS::Filespec::candelete\*(C'\fR operator. For instance, in orderto delete only files to which you have delete access, you couldsay something like.Sp.Vb 8\& sub safe_unlink {\& my($file,$num);\& foreach $file (@_) {\& next unless VMS::Filespec::candelete($file);\& $num += unlink $file;\& }\& $num;\& }.Ve.Sp(or you could just use \f(CW\*(C`VMS::Stdio::remove\*(C'\fR, if you've installedthe VMS::Stdio extension distributed with Perl). If \f(CW\*(C`unlink\*(C'\fR has tochange the file protection to delete the file, and you interrupt itin midstream, the file may be left intact, but with a changed \s-1ACL\s0allowing you delete access..SpThis behavior of \f(CW\*(C`unlink\*(C'\fR is to be compatible with \s-1POSIX\s0 behaviorand not traditional \s-1VMS\s0 behavior..IP "utime \s-1LIST\s0" 4.IX Item "utime LIST"This operator changes only the modification time of the file (\s-1VMS\s0 revision date) on \s-1ODS\-2\s0 volumes and \s-1ODS\-5\s0 volumes without access dates enabled. On \s-1ODS\-5\s0 volumes with access dates enabled, the true access time is modified..IP "waitpid \s-1PID\s0,FLAGS" 4.IX Item "waitpid PID,FLAGS"If \s-1PID\s0 is a subprocess started by a piped \f(CW\*(C`open()\*(C'\fR (see open), \&\f(CW\*(C`waitpid\*(C'\fR will wait for that subprocess, and return its final statusvalue in \f(CW$?\fR. If \s-1PID\s0 is a subprocess created in some other way (e.g.SPAWNed before Perl was invoked), \f(CW\*(C`waitpid\*(C'\fR will simply check once persecond whether the process has completed, and return when it has. (If\&\s-1PID\s0 specifies a process that isn't a subprocess of the current process,and you invoked Perl with the \f(CW\*(C`\-w\*(C'\fR switch, a warning will be issued.).SpReturns \s-1PID\s0 on success, \-1 on error. The \s-1FLAGS\s0 argument is ignoredin all cases..SH "Perl variables".IX Header "Perl variables"The following VMS-specific information applies to the indicated\&\*(L"special\*(R" Perl variables, in addition to the general informationin perlvar. Where there is a conflict, this informationtakes precedence..ie n .IP "%ENV" 4.el .IP "\f(CW%ENV\fR" 4.IX Item "%ENV"The operation of the \f(CW%ENV\fR array depends on the translationof the logical name \fI\s-1PERL_ENV_TABLES\s0\fR. If defined, it shouldbe a search list, each element of which specifies a locationfor \f(CW%ENV\fR elements. If you tell Perl to read or set theelement \f(CW\*(C`$ENV{\*(C'\fR\fIname\fR\f(CW\*(C`}\*(C'\fR, then Perl uses the translations of\&\fI\s-1PERL_ENV_TABLES\s0\fR as follows:.RS 4.IP "\s-1CRTL_ENV\s0" 4.IX Item "CRTL_ENV"This string tells Perl to consult the \s-1CRTL\s0's internal \f(CW\*(C`environ\*(C'\fRarray of key-value pairs, using \fIname\fR as the key. In most cases,this contains only a few keys, but if Perl was invoked via the C\&\f(CW\*(C`exec[lv]e()\*(C'\fR function, as is the case for \s-1CGI\s0 processing by some\&\s-1HTTP\s0 servers, then the \f(CW\*(C`environ\*(C'\fR array may have been populated bythe calling program..IP "CLISYM_[\s-1LOCAL\s0]" 4.IX Item "CLISYM_[LOCAL]"A string beginning with \f(CW\*(C`CLISYM_\*(C'\fRtells Perl to consult the \s-1CLI\s0'ssymbol tables, using \fIname\fR as the name of the symbol. When readingan element of \f(CW%ENV\fR, the local symbol table is scanned first, followedby the global symbol table.. The characters following \f(CW\*(C`CLISYM_\*(C'\fR aresignificant when an element of \f(CW%ENV\fR is set or deleted: if thecomplete string is \f(CW\*(C`CLISYM_LOCAL\*(C'\fR, the change is made in the localsymbol table; otherwise the global symbol table is changed.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -