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