UNIVERSAL::exports - Lightweight, universal exporting of variables |
UNIVERSAL::exports - Lightweight, universal exporting of variables
package Foo; use UNIVERSAL::exports;
# Just like Exporter. @EXPORT = qw($This &That); @EXPORT_OK = qw(@Left %Right);
# Meanwhile, in another piece of code! package Bar; use Foo; # exports $This and &That.
This is an alternative to Exporter intended to provide a universal, lightweight subset of its functionality. It uses Exporter::Lite, so look there for details.
Additionally, exports()
is provided to find out what symbols a
module exports.
UNIVERSAL::exports places its methods in the UNIVERSAL namespace, so there is no need to subclass from it.
UNIVERSAL::exports has two public methods, import()
derived from
Exporter::Lite, and exports().
Some::Module->import; Some::Module->import(@symbols);
This is Exporter::Lite's import()
method. Look in the Exporter::Lite manpage
for details.
@exported_symbols = Some::Module->exports; Some::Module->exports($symbol);
Reports what symbols are exported by Some::Module. With no arguments, it simply returns a list of all exportable symbols. Otherwise, it reports if it will export a given $symbol.
Michael G Schwern <schwern@pobox.com>
Please report bugs and issues via http://rt.cpan.org
Copyright 2001, 2006 Michael G Schwern
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://www.perl.com/perl/misc/Artistic.html
Other ways to Export: the Exporter manpage, the Exporter::Lite manpage, the Sub::Exporter manpage, the Exporter::Simple manpage
The Perl 6 RFC that started it all: http://dev.perl.org/rfc/257.pod
More UNIVERSAL magic: the UNIVERSAL::require manpage
UNIVERSAL::exports - Lightweight, universal exporting of variables |