1UNIVERSAL::exports(3) User Contributed Perl DocumentationUNIVERSAL::exports(3)
2
3
4
6 UNIVERSAL::exports - Lightweight, universal exporting of variables
7
9 package Foo;
10 use UNIVERSAL::exports;
11
12 # Just like Exporter.
13 @EXPORT = qw($This &That);
14 @EXPORT_OK = qw(@Left %Right);
15
16 # Meanwhile, in another piece of code!
17 package Bar;
18 use Foo; # exports $This and &That.
19
21 This is an alternative to Exporter intended to provide a universal,
22 lightweight subset of its functionality. It uses Exporter::Lite, so
23 look there for details.
24
25 Additionally, "exports()" is provided to find out what symbols a module
26 exports.
27
28 UNIVERSAL::exports places its methods in the UNIVERSAL namespace, so
29 there is no need to subclass from it.
30
32 UNIVERSAL::exports has two public methods, import() derived from
33 Exporter::Lite, and exports().
34
35 import
36 Some::Module->import;
37 Some::Module->import(@symbols);
38
39 This is Exporter::Lite's import() method. Look in Exporter::Lite
40 for details.
41
42 exports
43 @exported_symbols = Some::Module->exports;
44 Some::Module->exports($symbol);
45
46 Reports what symbols are exported by Some::Module. With no argu‐
47 ments, it simply returns a list of all exportable symbols. Other‐
48 wise, it reports if it will export a given $symbol.
49
51 '"%s" is not exported by the %s module'
52 Attempted to import a symbol which is not in @EXPORT or @EXPORT_OK.
53
54 'Can\'t export symbol: %s'
55 Attempted to import a symbol of an unknown type (ie. the leading
56 $@% salad wasn't recognized).
57
59 Michael G Schwern <schwern@pobox.com>
60
62 Please report bugs and issues via <http://rt.cpan.org>
63
65 Copyright 2001, 2006 Michael G Schwern
66
67 This program is free software; you can redistribute it and/or modify it
68 under the same terms as Perl itself.
69
70 See <http://www.perl.com/perl/misc/Artistic.html>
71
73 Other ways to Export: Exporter, Exporter::Lite, Sub::Exporter,
74 Exporter::Simple
75
76 The Perl 6 RFC that started it all: <http://dev.perl.org/rfc/257.pod>
77
78 More UNIVERSAL magic: UNIVERSAL::require
79
80
81
82perl v5.8.8 2006-09-03 UNIVERSAL::exports(3)