as - load OO module under another name


as documentation  | view source Contained in the as distribution.

Index


NAME

Top

as - load OO module under another name

VERSION

Top

This documentation describes version 0.06.

SYNOPSIS

Top

    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

Top

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

Top

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

Top

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

Top

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

Top

 (none)

AUTHOR

Top

Elizabeth Mattijsen, <liz@dijkmat.nl>.

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

COPYRIGHT

Top


as documentation  | view source Contained in the as distribution.