# from Eric Wilhelm
# on Sunday 24 May 2009:
>I
>want something which aliases an entire class hierarchy and loads
>modules from it on demand.
>
> use aliased::factory YAPI => 'Yahoo::Marketing';
>
> # this does: require Yahoo::Marketing::KeywordResearchService
> # and calls Yahoo::Marketing::KeywordResearchService->new(...)
> my $ybis = YAPI::KeywordResearchService(...);
With advice from hdp^Wconfound on irc, I went with a method-call
interface where the object is a factory. When you call new() you get
the thing, when you call anything else, you get the subpackage
corresponding to that method name. This removes the one-level
limitation without too much added typing. Sorry if you're have a
new.pm!
my $ybis = YAPI->KewordResearchService->new(...);
It's on the way to the CPAN now.
--Eric
--
As an old bass player friend of mine used to say: throw money, don't
clap.
--Tony Parisi
---------------------------------------------------
http://scratchcomputing.com
---------------------------------------------------