On Tue, 2005-01-04 at 18:29 -0500, Randy W. Sims wrote:

> There is Package::Alias[1]. Does the same thing, but I haven't used it.
> 
Upon a quick glance, this does a similar thing but via a different
mechanism.

Ovid's module installs a constant sub into the caller's namespace which
returns the long name of the module.  All this is really good for is
calling class methods.

        use Aliased 'Long::Module::Name' as 'Name';
        # i.e.   use constant Name => 'Long::Module::Name';
        
        Name->new();  # Works
        print $Name::VERSION; # Doesn't work.
        
Package::Alias sounds like it messes with the stash, something like

        $::{'Name::'} = $::{'Long::Module::Name::'}
        
if I recall the syntax correctly.  The downside to this approach is that
objects created via an aliased package name will be blessed into the
aliased package name rather than the original one, which could confuse
things.

> I like the idea of it being a pragma; 'aka' seems kinda perlish.
> 
> It'd be nice if this was supported in perl, so it would be possible to 
> alias entire namespaces
> 
> use aka 'Apache2::Apache::' as 'Apache::';  # ;-)
> 
> Which would all all modules in the first namespace to be addressed as if 
> they were in the second, including munging %INC so it does the right thing.

This is a completely different problem, requiring a different solution.

For the record, I still like the name 'aliased', partly because I'm used
to it.
-- 
Bruce J Keeler <[EMAIL PROTECTED]>

Reply via email to