Is there nealy same module? ExportTo
Is there nealy same module? ExportTo
am 11.03.2006 14:14:10 von ktat
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.
============================================================ ==================
--
Ktat
atusi@pure.ne.jp
Re: Is there nealy same module? ExportTo
am 14.03.2006 20:56:33 von Jimi-Carlo Bukowski-Wills
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.
> ============================================================ ==================
>
Re: Is there nealy same module? ExportTo
am 15.03.2006 14:53:46 von ktat
Exporter can export function/method to any namespace?
I didn't know it.
Re: Is there nealy same module? ExportTo
am 15.03.2006 17:21:53 von Paul Lalli
ktat wrote:
> 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
I am massively confused by this. Can you provide an example of when you
would actually want to use this functionality? In what cases or
situations does a module know to which namespace(s) it should export
its members?
Paul Lalli
Re: Is there nealy same module? ExportTo
am 17.03.2006 13:25:04 von ktat
Paul Lalli wrote:
> ktat wrote:
> > 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
>
> I am massively confused by this. Can you provide an example of when you
> would actually want to use this functionality? In what cases or
> situations does a module know to which namespace(s) it should export
> its members?
Indeed, it may be rare case to use this module ....
But, for example. The case I don't know one class very much,
but I want to replace some function.
The class is depend on other class and complex, so I cannot write its
sub class and
it is dengerous to modify original source code.
It's my case.
http://www.pure.ne.jp/~learner/cgi-bin/diary/Master/200603.h tm#20060308-1
I don't know Kwiki system detail. but I want to change one method,
but I don't know whether this modification is right or not.
So I don't modify original souce code and use this module.
--
Ktat
atusi@pure.ne.jp