perlvms.pod
来自「视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.」· POD 代码 · 共 1,224 行 · 第 1/4 页
POD
1,224 行
=head1 NAMEperlvms - VMS-specific documentation for Perl=head1 DESCRIPTIONGathered below are notes describing details of Perl 5's behavior on VMS. They are a supplement to the regular Perl 5 documentation, so we have focussed on the ways in which Perl 5 functions differently under VMS than it does under Unix, and on the interactions between Perl and the rest of the operating system. We haven't tried to duplicate complete descriptions of Perl features from the main Perl documentation, which can be found in the F<[.pod]> subdirectory of the Perl distribution.We hope these notes will save you from confusion and lost sleep when writing Perl scripts on VMS. If you find we've missed something you think should appear here, please don't hesitate to drop a line to vmsperl@perl.org.=head1 InstallationDirections for building and installing Perl 5 can be found in the file F<README.vms> in the main source directory of the Perl distribution..=head1 Organization of Perl Images=head2 Core ImagesDuring the installation process, three Perl images are produced.F<Miniperl.Exe> is an executable image which contains all ofthe basic functionality of Perl, but cannot take advantage ofPerl extensions. It is used to generate several files neededto build the complete Perl and various extensions. Once you'vefinished installing Perl, you can delete this image.Most of the complete Perl resides in the shareable imageF<PerlShr.Exe>, which provides a core to which the Perl executableimage and all Perl extensions are linked. You should place thisimage in F<Sys$Share>, or define the logical name F<PerlShr> totranslate to the full file specification of this image. It shouldbe world readable. (Remember that if a user has execute only accessto F<PerlShr>, VMS will treat it as if it were a privileged shareableimage, and will therefore require all downstream shareable images to beINSTALLed, etc.)Finally, F<Perl.Exe> is an executable image containing the mainentry point for Perl, as well as some initialization code. Itshould be placed in a public directory, and made world executable.In order to run Perl with command line arguments, you shoulddefine a foreign command to invoke this image.=head2 Perl ExtensionsPerl extensions are packages which provide both XS and Perl codeto add new functionality to perl. (XS is a meta-language whichsimplifies writing C code which interacts with Perl, seeL<perlxs> for more details.) The Perl code for anextension is treated like any other library module - it'smade available in your script through the appropriateC<use> or C<require> statement, and usually defines a Perlpackage containing the extension.The portion of the extension provided by the XS code may beconnected to the rest of Perl in either of two ways. In theB<static> configuration, the object code for the extension islinked directly into F<PerlShr.Exe>, and is initialized wheneverPerl is invoked. In the B<dynamic> configuration, the extension'smachine code is placed into a separate shareable image, which ismapped by Perl's DynaLoader when the extension is C<use>d orC<require>d in your script. This allows you to maintain theextension as a separate entity, at the cost of keeping track of theadditional shareable image. Most extensions can be set up as eitherstatic or dynamic.The source code for an extension usually resides in its owndirectory. At least three files are generally provided:I<Extshortname>F<.xs> (where I<Extshortname> is the portion ofthe extension's name following the last C<::>), containingthe XS code, I<Extshortname>F<.pm>, the Perl library modulefor the extension, and F<Makefile.PL>, a Perl script which usesthe C<MakeMaker> library modules supplied with Perl to generatea F<Descrip.MMS> file for the extension.=head2 Installing static extensionsSince static extensions are incorporated directly intoF<PerlShr.Exe>, you'll have to rebuild Perl to incorporate anew extension. You should edit the main F<Descrip.MMS> or F<Makefile>you use to build Perl, adding the extension's name to the C<ext>macro, and the extension's object file to the C<extobj> macro.You'll also need to build the extension's object file, eitherby adding dependencies to the main F<Descrip.MMS>, or using aseparate F<Descrip.MMS> for the extension. Then, rebuildF<PerlShr.Exe> to incorporate the new code.Finally, you'll need to copy the extension's Perl librarymodule to the F<[.>I<Extname>F<]> subdirectory under oneof the directories in C<@INC>, where I<Extname> is the nameof the extension, with all C<::> replaced by C<.> (e.g.the library module for extension Foo::Bar would be copiedto a F<[.Foo.Bar]> subdirectory).=head2 Installing dynamic extensionsIn general, the distributed kit for a Perl extension includesa file named Makefile.PL, which is a Perl program which is usedto create a F<Descrip.MMS> file which can be used to build andinstall the files required by the extension. The kit should beunpacked into a directory tree B<not> under the main Perl sourcedirectory, and the procedure for building the extension is simply $ perl Makefile.PL ! Create Descrip.MMS $ mmk ! Build necessary files $ mmk test ! Run test code, if supplied $ mmk install ! Install into public Perl treeI<N.B.> The procedure by which extensions are built andtested creates several levels (at least 4) under thedirectory in which the extension's source files live.For this reason if you are running a version of VMS priorto V7.1 you shouldn't nest the source directorytoo deeply in your directory structure lest you exceed RMS'maximum of 8 levels of subdirectory in a filespec. (Youcan use rooted logical names to get another 8 levels ofnesting, if you can't place the files near the top ofthe physical directory structure.)VMS support for this process in the current release of Perlis sufficient to handle most extensions. However, it doesnot yet recognize extra libraries required to build shareableimages which are part of an extension, so these must be addedto the linker options file for the extension by hand. Forinstance, if the F<PGPLOT> extension to Perl requires theF<PGPLOTSHR.EXE> shareable image in order to properly linkthe Perl extension, then the line C<PGPLOTSHR/Share> mustbe added to the linker options file F<PGPLOT.Opt> producedduring the build process for the Perl extension.By default, the shareable image for an extension is placed inthe F<[.lib.site_perl.auto>I<Arch>.I<Extname>F<]> directory of theinstalled Perl directory tree (where I<Arch> is F<VMS_VAX> orF<VMS_AXP>, and I<Extname> is the name of the extension, witheach C<::> translated to C<.>). (See the MakeMaker documentationfor more details on installation options for extensions.)However, it can be manually placed in any of several locations:=over 4=item *the F<[.Lib.Auto.>I<Arch>I<$PVers>I<Extname>F<]> subdirectoryof one of the directories in C<@INC> (where I<PVers>is the version of Perl you're using, as supplied in C<$]>,with '.' converted to '_'), or=item *one of the directories in C<@INC>, or=item *a directory which the extensions Perl library modulepasses to the DynaLoader when asking it to mapthe shareable image, or=item *F<Sys$Share> or F<Sys$Library>.=backIf the shareable image isn't in any of these places, you'll needto define a logical name I<Extshortname>, where I<Extshortname>is the portion of the extension's name after the last C<::>, whichtranslates to the full file specification of the shareable image.=head1 File specifications=head2 SyntaxWe have tried to make Perl aware of both VMS-style and Unix-style filespecifications wherever possible. You may use either style, or both,on the command line and in scripts, but you may not combine the twostyles within a single file specification. VMS Perl interprets Unixpathnames in much the same way as the CRTL (I<e.g.> the first componentof an absolute path is read as the device name for the VMS filespecification). There are a set of functions provided in theC<VMS::Filespec> package for explicit interconversion between VMS andUnix syntax; its documentation provides more details.We've tried to minimize the dependence of Perl librarymodules on Unix syntax, but you may find that some of these,as well as some scripts written for Unix systems, willrequire that you use Unix syntax, since they will assume that'/' is the directory separator, I<etc.> If you find instancesof this in the Perl distribution itself, please let us know,so we can try to work around them.Also when working on Perl programs on VMS, if you need a syntaxin a specific operating system format, then you need either tocheck the appropriate DECC$ feature logical, or call a conversionroutine to force it to that format.The feature logical name DECC$FILENAME_UNIX_REPORT modifies traditionalPerl behavior in the conversion of file specifications from UNIX to VMSformat in order to follow the extended character handling rules nowexpected by the CRTL. Specifically, when this feature is in effect, theC<./.../> in a UNIX path is now translated to C<[.^.^.^.]> instead ofthe traditional VMS C<[...]>. To be compatible with what MakeMakerexpects, if a VMS path cannot be translated to a UNIX path, it ispassed through unchanged, so C<unixify("[...]")> will return C<[...]>.The handling of extended characters is largely complete in theVMS-specific C infrastructure of Perl, but more work is still needed tofully support extended syntax filenames in several core modules. Inparticular, at this writing PathTools has only partial support fordirectories containing some extended characters.There are several ambiguous cases where a conversion routine cannotdetermine whether an input filename is in UNIX format or in VMS format,since now both VMS and UNIX file specifications may have characters inthem that could be mistaken for syntax delimiters of the other type. Sosome pathnames simply cannot be used in a mode that allows either typeof pathname to be present. Perl will tend to assume that an ambiguousfilename is in UNIX format.Allowing "." as a version delimiter is simply incompatible withdetermining whether a pathname is in VMS format or in UNIX format withextended file syntax. There is no way to know whether "perl-5.8.6" is aUNIX "perl-5.8.6" or a VMS "perl-5.8;6" when passing it to unixify() orvmsify().The DECC$FILENAME_UNIX_REPORT logical name controls how Perl interpretsfilenames to the extent that Perl uses the CRTL internally for manypurposes, and attempts to follow CRTL conventions for reportingfilenames. The DECC$FILENAME_UNIX_ONLY feature differs in that itexpects all filenames passed to the C run-time to be already in UNIXformat. This feature is not yet supported in Perl since Perl usestraditional OpenVMS file specifications internally and in the testharness, and it is not yet clear whether this mode will be useful oruseable. The feature logical name DECC$POSIX_COMPLIANT_PATHNAMES is newwith the RMS Symbolic Link SDK and included with OpenVMS v8.3, but isnot yet supported in Perl.=head2 Filename CasePerl follows VMS defaults and override settings in preserving (or notpreserving) filename case. Case is not preserved on ODS-2 formattedvolumes on any architecture. On ODS-5 volumes, filenames may be casepreserved depending on process and feature settings. Perl now honorsDECC$EFS_CASE_PRESERVE and DECC$ARGV_PARSE_STYLE on those systems wherethe CRTL supports these features. When these features are not enabledor the CRTL does not support them, Perl follows the traditional CRTLbehavior of downcasing command-line arguments and returning filespecifications in lower case only.I<N. B.> It is very easy to get tripped up using a mixture of otherprograms, external utilities, and Perl scripts that are in varyingstates of being able to handle case preservation. For example, a filecreated by an older version of an archive utility or a build utilitysuch as MMK or MMS may generate a filename in all upper case even on anODS-5 volume. If this filename is later retrieved by a Perl script ormodule in a case preserving environment, that upper case name may notmatch the mixed-case or lower-case expections of the Perl code. Yourbest bet is to follow an all-or-nothing approach to case preservation:either don't use it at all, or make sure your entire toolchain andapplication environment support and use it.OpenVMS Alpha v7.3-1 and later and all version of OpenVMS I64 supportcase sensitivity as a process setting (see C<SET PROCESS/CASE_LOOKUP=SENSITIVE>). Perl does not currently suppport casesensitivity on VMS, but it may in the future, so Perl programs shoulduse the C<File::Spec->case_tolerant> method to determine the state, andnot the C<$^O> variable.=head2 Symbolic LinksWhen built on an ODS-5 volume with symbolic links enabled, Perl bydefault supports symbolic links when the requisite support is availablein the filesystem and CRTL (generally 64-bit OpenVMS v8.3 and later). There are a number of limitations and caveats to be aware of whenworking with symbolic links on VMS. Most notably, the target of a validsymbolic link must be expressed as a UNIX-style path and it must existon a volume visible from your POSIX root (see the C<SHOW ROOT> commandin DCL help). For further details on symbolic link capabilities andrequirements, see chapter 12 of the CRTL manual that ships with OpenVMSv8.3 or later.=head2 Wildcard expansionFile specifications containing wildcards are allowed both on the command line and within Perl globs (e.g. C<E<lt>*.cE<gt>>). Ifthe wildcard filespec uses VMS syntax, the resultant filespecs will follow VMS syntax; if a Unix-style filespec is passed in, Unix-style filespecs will be returned.Similar to the behavior of wildcard globbing for a Unix shell,one can escape command line wildcards with double quotationmarks C<"> around a perl program command line argument. However,owing to the stripping of C<"> characters carried out by the Chandling of argv you will need to escape a construct such asthis one (in a directory containing the files F<PERL.C>, F<PERL.EXE>,F<PERL.H>, and F<PERL.OBJ>):
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?