On Thu, 2005-01-06 at 20:08 -0600, David Nicol wrote: > I don't understand what's being contemplated here. > I think we're talking about recreating Package::Alias, > which is essentially sugar around > > use really::long::name::ending::bar; > BEGIN { > *bar:: = \*really::long::name::ending::bar:: > } > > after which the methods in RLNEB can be referred to > with the much shorter > > &bar::widget($arg1, $arg2); > > How does the contemplated module differ from Package::Alias? > It's similar, but different. The proposed module does not alias the package at the level that Package::Alias does, i.e. by messing around with the stash and globs. What it does is first "require" the package, then insert a constant sub into the caller's package which returns the long name of the package. This makes it easier to call class methods, but does not allow calls of the type you show above. Thus:
use aka 'Really::Long::Package::Name' => "ShortName"; # equiv to use constant ShortName => "Really::Long::Package::Name"; ShortName->new(...); # works &ShortName::new(...); # doesn't work print $ShortName::VERSION; # doesn't work The advantage of this over the more low-level Package::Alias method is that objects are blessed into the correct path. After package Foo; *ShortName:: = \*Really::Long::Package::Name::; my $foo = ShortName->new(...); $foo would be blessed into Foo::Shortname, or possibly just ShortName instead of its proper package. It really is a very useful module; I've been using it for almost a year and now can't live without it. -- Bruce J Keeler <[EMAIL PROTECTED]>