perl 包和模块

来源:互联网 发布:歌曲升降调软件 编辑:程序博客网 时间:2024/05/21 06:58
moduleA file that defines a package of (almost) the same name, which can either export symbols or function as an object class. (A module's main .pm file may also load in other files in support of the module.) See the use built-in.一个定义了和包相同名字的文件packageA namespace for global variables, subroutines, and the like, such that they can be kept separate from like-named symbols in other namespaces. In a sense, only the package is global, since the symbols in the package's symbol table are only accessible from code compiled outside the package by naming the package. But in another sense, all package symbols are also globals--they're just well-organized globals.一个包是是存储,全局变量,子函数,依次类推。,只有包是全局的,他们可以用类似的符号放在不同的名字空间。有一个观念,只有包是全局的。一个perl文件(一般以.pm结尾)就可以称为一个模块了。一个包的定义可以跨多个模块,一个模块中也可以有多个包定义。当你适用package时,你在为你自己的变量,方法提供一个容身之所

0 0