develooper Front page | perl.perl5.porters | Postings from May 2004

Re: Tying a namespace

Thread Previous
From:
Rafael Garcia-Suarez
Date:
May 27, 2004 23:55
Subject:
Re: Tying a namespace
Message ID:
20040528085306.3c20d51a@localhost
Luke Palmer wrote:
> Is there a way to tie a namespace hash.  As in, I can do this:
> 
>     BEGIN { *Foo::Bar:: = \%Baz:: }
> 
> And make Foo::Bar:: an alias of Baz::, but I can't do:
> 
>     BEGIN {
>         tie my %impl => Something;
>         *Foo::Bar:: = \%impl;
>     }
> 
> And get something like:
> 
>     print $Foo::Bar::x
> 
> To call Something::FETCH.  Is there a way to do this?

No (not without core patches. And I'm not sure slowing down stash lookup
is acceptable.)

This subject came up before : see the p5p summary at
http://dev.perl.org/perl5/list-summaries/2003/p5p-200312-2.html

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About