Perl Cd Bookshelf [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Perl Cd Bookshelf [Electronic resources] - نسخه متنی

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید

8.66. Exporter


Implements a
default import method for other modules to inherit if they
don't want to define their own. If you are writing a
module, you can do the following:

package Module;
use Exporter ( );
@ISA = qw(Exporter);
@EXPORT = qw(...);
@EXPORT_OK = qw(...);
%EXPORT_TAGS = (tag => [...]);

in which @EXPORT is a list of symbols to export by
default, @EXPORT_OK is a list of symbols to export
on request, and %EXPORT_TAGS is a hash that
defines names for sets of symbols. Names in
%EXPORT_TAGS must also appear in
@EXPORT or @EXPORT_OK.

Then Perl programs that want to use your module just say:

use Module;                   # Import default symbols
use Module qw(...); # Import listed symbols
use Module ( ); # Do not import any symbols

The Exporter can handle specialized import lists. An import list is
the list of arguments passed to the import method.
If the first entry begins with !, :, or
/, the list is treated as a series of
specifications that add to or delete from the list. A leading
! means delete, rather than add.























Symbol


Meaning


[!]name


This name only


[!]:DEFAULT


All names in @EXPORT


[!]:tag


All names in
$EXPORT_TAGS{tag}
anonymous list


[!]/pattern/


All names in @EXPORT and
@EXPORT_OK that match
pattern

Exporter's methods are the following.


module_name->export_fail(failed_symbols)

Returns a list of symbols that couldn''''t be imported.
The default method provided by Exporter returns the list unchanged.


export_ok_tags(taglist)

Adds tagged sets of symbols to @EXPORT_OK.


export_tags(taglist)

Adds tagged sets of symbols to @EXPORT.


package->export_to_level(n, what_to_export)

Used when you can't use Exporter's
import method directly. Takes the following arguments:


n

An integer specifying how far up the calling stack to export your
symbols


what_to_export

Array of symbols to export, usually @_



import

The default import method.


module_name->require_version(value)

Validates the version of module
module_name, checking that it is at least
value.

/ 875