Elizabeth Mattijsen > as-0.08 > as

Download:
as-0.08.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.08   Source  

NAME ^

as - load OO module under another name

VERSION ^

This documentation describes version 0.08.

SYNOPSIS ^

    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

DESCRIPTION ^

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.

INSPIRATION ^

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.

THEORY OF OPERATION ^

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.

CAVEATS ^

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.

REQUIRED MODULES ^

 warnings::register (any)

AUTHOR ^

Elizabeth Mattijsen, <liz@dijkmat.nl>.

Please report bugs to <perlbugs@dijkmat.nl>.

COPYRIGHT ^

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

syntax highlighting: