2008/6/20 Hans Dieter Pearcey <[EMAIL PROTECTED]>:
> On Fri, Jun 20, 2008 at 04:19:41PM +0100, Fergal Daly wrote:
>> To be a little more constructive. Here's something that is
>> implementable and I think reasonable.
>>
>> use Foo::Bar;
>>
>> never does anything to the importing package
>>
>> use Foo::Bar as => Bar;
>>
>> plops a constant function Bar into your package. The constant is an
>> object on which you can do
>>
>> Bar->some_function(@args)
>>
>> and it is the equivalent of calling
>>
>> Foo::Bar::some_function(@args)
>
> In my TODO is an entry for implementing this for Sub::Exporter.
>
> You don't even need to use AUTOLOAD:
>
> * create Some::Long::Generated::Package

If you're going to use a generated package then you can use AUTOLOAD
just for the first call and oyu can put AUTOLOAD into a base class.

> * import symbols from Foo::Bar into SLGP, wrapping each with
>  sub { shift; $original_code->(@_) }

I would

sub { shift;  &goto $oringal_code }

so the whole thing is entirely transparent from a stack point of view.

> * export Bar() into the calling package
>  sub Bar () { "Some::Long::Generated::Package" }

Glad I'm not on my own wanting this :)

F

> hdp.
>

Reply via email to