as - load OO module under another name
This documentation describes version 0.08.
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 (http://www.perlmonks.org/index.pl?node_id=299082) 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.
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.
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.
Elizabeth Mattijsen, <email@example.com>.
Please report bugs to <firstname.lastname@example.org>.
Copyright (c) 2003, 2004, 2005, 2006, 2009, 2012 Elizabeth Mattijsen <email@example.com>. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.