No::Worries::Export man page on Fedora

Man page or keyword search:  
man Server   31170 pages
apropos Keyword Search (all sections)
Output format
Fedora logo
[printable version]

No::Worries::Export(3)User Contributed Perl DocumentatioNo::Worries::Export(3)

NAME
       No::Worries::Export - symbol exporting without worries

SYNOPSIS
	 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.

       The symbols that can be imported are defined in a hash (the third
       argument of export_control()), the key being the symbol name and the
       value being:

       ·   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.

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 an "import" method

SEE ALSO
       Exporter, No::Worries.

AUTHOR
       Lionel Cons <http://cern.ch/lionel.cons>

       Copyright CERN 2012

perl v5.14.3			  2012-12-19		No::Worries::Export(3)
[top]

List of man pages available for Fedora

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net