in reply to package namespaces
package Bar; use Foo::XXX; sub create_foo { return Foo::XXX->new(@_); }
Idea is that you don't call constructors directly (i.e. Foo::XXX->new) but delegate it to third party (i.e package Bar). This way you don't have to put name of Foo:XXX package in your code. You can always create its instancies via Bar package:
use Bar; my $foo = Bar->create_foo;
If at some moment you decide to start using package Foo::YYY->new instead of Foo::XXX->new than the only place you have to modify is Bar::create_foo().
--
Ilya Martynov
(http://martynov.org/)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: package namespaces
by mab (Acolyte) on Jun 04, 2002 at 21:54 UTC |