X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FExporter.pm;h=adc843b9f5cac78a8849e08aaedd05212c8da29a;hb=4fddf32b02405fe6f8dbd7b7013cd63eb6be0196;hp=bc07e9b2bec08513608bfd8b38ca7c7a667c0cce;hpb=4af1b1670777e479b4ed7b579fcf6e8dabdeedc8;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/Exporter.pm b/lib/Exporter.pm index bc07e9b..adc843b 100644 --- a/lib/Exporter.pm +++ b/lib/Exporter.pm @@ -118,6 +118,18 @@ in L and L. Understanding the concept of modules and how the C statement operates is important to understanding the Exporter. +=head2 How to Export + +The arrays C<@EXPORT> and C<@EXPORT_OK> in a module hold lists of +symbols that are going to be exported into the users name space by +default, or which they can request to be exported, respectively. The +symbols can represent functions, scalars, arrays, hashes, or typeglobs. +The symbols must be given by full name with the exception that the +ampersand in front of a function is optional, e.g. + + @EXPORT = qw(afunc $scalar @array); # afunc is a function + @EXPORT_OK = qw(&bfunc %hash *typeglob); # explicit prefix on &bfunc + =head2 Selecting What To Export Do B export method names! @@ -196,11 +208,12 @@ Exporter has a special method, 'export_to_level' which is used in situations where you can't directly call Export's import method. The export_to_level method looks like: -MyPackage->export_to_level($where_to_export, @what_to_export); +MyPackage->export_to_level($where_to_export, $package, @what_to_export); where $where_to_export is an integer telling how far up the calling stack to export your symbols, and @what_to_export is an array telling what -symbols *to* export (usually this is @_). +symbols *to* export (usually this is @_). The $package argument is +currently unused. For example, suppose that you have a module, A, which already has an import function: