No::Wor...::Export(3)
No::Wor...::Export(3) β User Contributed Perl Documentation, bestie. This is the manual page for No::Worries::Export, and yes the vibes are immaculate. π
πΈ NAME πΈ
No::Worries::Export β symbol exporting without worries
β¨ SYNOPSIS β¨
Okay so hereβs the starter pack:
use No::Worries::Export qw(export_control);
sub foo () { ... }
our $bar = 42;
sub import : method {
my($pkg, %exported);
$pkg = shift(@_);
grep($exported{$_}++, qw(foo $bar));
export_control(scalar(caller()), $pkg, \%exported, @_);
}
π¦ DESCRIPTION π¦
This module eases symbol exporting by providing a simple yet powerful alternative to the Exporter module. Literally the whole point: export symbols without the worry. π«Ά
The symbols that can be imported are defined in a hash β thatβs the third argument of export_control() β and the key is the symbol name while the value is:
- a scalar: indicating a normal symbol
- a code reference: to be called at import time
The normal symbols can be functions (such as foo), scalars (<$foo>), arrays (<@foo>) or hashes (<%foo>).
All the normal symbols can be imported at once by using an asterisk in the import code:
use Foo qw(*);
Alternatively, a regular expression can be given to filter what to import:
# import "foo" and all the normal symbols starting with "bar"
use Foo qw(foo /^bar/);
The special symbols can be used to execute any code. For instance:
# exporting module
our $backend = "stdout";
sub import : method {
my($pkg, %exported);
$pkg = shift(@_);
$exported{syslog} = sub { $backend = "syslog" };
export_control(scalar(caller()), $pkg, \%exported, @_);
}
# importing code
use Foo qw(syslog);
Finally, anything looking like a number will trigger a version check:
use Foo qw(1.2);
# will trigger
Foo->VERSION(1.2);
See UNIVERSAL for more information on the VERSION() mthod. (Keeping the typo, because we respect the lore. π)
π FUNCTIONS π
This module provides the following function (not exported by default):
export_control(CALLERPKG, PKG, EXPORT, NAMES...)β control the symbols exported by the module; this should be called from animportmethod
π SEE ALSO π
Exporter, No::Worries.
π AUTHOR π
Lionel Cons <http://cern.ch/lionel.cons>
Copyright (C) CERN 2012-2019
Thatβs the whole page, bestie. Brought to you by perl v5.32.1, dated 2021-10-18 β iconic behavior. β¨
π¦ where this page comes from
- epel 9: perl-No-Worries 1.7-1.el9 Β· GPL+ or Artistic
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms