----- Original Message ---- > From: Eric Wilhelm <[email protected]>
> I'm looking for something like aliased.pm, but with a more specific > functionality. Where aliased.pm only renames (and loads) one class, 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(...); > > my $res = $ybis->getRelatedKeywords( > relatedKeywordRequest => YAPI::RelatedKeywordRequestType(...) > ); I was asked once if I would extend aliased to do something similar: use aliased 'Yahoo::Marketing::*'; That's similar to the java import: import java.awt.*; That's now considered to be a bad practice (though still common). I was convinced not to do it. You can find discussion at http://use.perl.org/~Ovid/journal/34021 That being said, feel free to give it a try. Cheers, Ovid -- Buy the book - http://www.oreilly.com/catalog/perlhks/ Tech blog - http://use.perl.org/~Ovid/journal/ Twitter - http://twitter.com/OvidPerl Official Perl 6 Wiki - http://www.perlfoundation.org/perl6
