Re: Is there nealy same module? ExportTo



Exporter??

is it a joke?

ktat wrote:
Hi, All.

I have one module my calling ExportTo. It easily export function/method
to anywhere.
If you know a module like it, please tell me.
If there are no modules like this, I want to upload this to CPAN.

==============================================================================
NAME
ExportTo - export function/method to namespace

SYNOPSIS
package From;

sub function1{ ... }

sub function2{ ... }

sub function3{ ... }

use ExportTo (NameSpace1 => [qw/function1 function2/], NameSpace2
=> [qw/function3/]);

# Now, function1 and function2 are exported to 'NameSpace1'
namespace.
# function3 is exported to 'NameSpace2' namespace.

# If 'NameSpace1'/'NameSpace2' namespace has same name
function/method,
# such a function/method is not exported and ExportTo croaks.
# but if you want to override, you can do it as following.

use ExportTo (NameSpace1 => qw/+function1 function2/);

# if adding + to function/method name,
# This override function/method which namespace already has with
exported funtion/method.

use ExportTo ('+NameSpace' => qw/function1 function2/);

# if you add + to namespace name, all functions are exported even
if namespace already has function/method.
==============================================================================

.



Relevant Pages

  • Is there nealy same module? ExportTo
    ... I have one module my calling ExportTo. ... ExportTo - export function/method to namespace ... sub function1{... ...
    (comp.lang.perl.modules)
  • Re: the annoying, verbose self
    ... local/global variables, and function/method calls? ... creates a new namespace: ... "with math" creates a newer ...
    (comp.lang.python)
  • Re: Are decorators really that different from metaclasses...
    ... > docstring, if present) would occur in the namespace of the object ... > (function/method) being defined. ... the assignment to author occurs in the local namespace. ... How is this not causing assignments to change ...
    (comp.lang.python)