The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.


as - load OO module under another name


This documentation describes version 0.13.


    use as;  # activate 'use' magic
    use Very::Long::Module::Name as => 'Foo';
    use Other::Long::Module::Name qw(parameters being passed), as => 'Bar';

    my $foo = Foo->new; # blessed as Very::Long::Module::Name
    my $bar = Bar->new; # blessed as Other::Long::Module::Name


Sometimes you get sick of having to use long module names. This module allows you to load a module and have it be aliased to another name.


Originaly Inspired by bart's response ( to a thread about long module names on Perl Monks.


This module injects its own handling of require so that it can intercept any "as module" parameters. If found, it will alias the stash of the original module with the name to be aliased.


blessed as what?

Any objects blessed with the aliased class name, will actually return the original module's name as the classed it has been blessed with. You could consider this as either a bug or a feature.

calling "import" ?

If there is an import class method available for the module being aliased, then this will only be called if any parameters (others than "as modulename") have been specified. This behaviour is based on the fact that this is the most likely wanted behaviour for object oriented modules, which rarely require an import method anyway.


 warnings::register (any)


Elizabeth Mattijsen, <>.

maintained by LNATION, <>

Please report bugs to <>.


Copyright (c) 2003, 2004, 2005, 2006, 2009, 2012 Elizabeth Mattijsen <>. 2021 LNATION <> All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.