The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Package::Alias - alias one namespace into another

SYNOPSIS

  use Package::Alias
      main => 'Foo::Bar',
      Package::Name::Simply::Too::Long::To::Use => 'Pkg';

DESCRIPTION

This module aliases one package name to another. After running the SYNOPSIS code, @INC and @Foo::Bar::INC reference the same memory. $Package::Name::Simply::Too::Long::To::Use::var and $Pkg::var do as well.

Chip Salzenberg says that it's not technically feasible to perform runtime namespace aliasing. At compile time, Perl grabs pointers to functions and global vars. Those pointers aren't updated if we alias the namespace at runtime.

AUTHOR

Joshua Keroes <skunkworks@eli.net>

BUGS

alias() should return success or failure but I don't know what to check. Help?

SEE ALSO

Devel::Symdump