++ed by:
JRMASH PHAYLON TMUELLER

3 PAUSE user(s)
4 non-PAUSE user(s).

Jesse Luehrs
and 3 contributors

NAME

MooseX::Aliases - easy aliasing of methods and attributes in Moose

VERSION

version 0.05

SYNOPSIS

    package MyApp;
    use Moose;
    use MooseX::Aliases;

    has this => (
        isa   => 'Str',
        is    => 'rw',
        alias => 'that',
    );

    sub foo { my $self = shift; print $self->that }
    alias bar => 'foo';

    my $o = MyApp->new();
    $o->this('Hello World');
    $o->bar; # prints 'Hello World'

or

    package MyApp::Role;
    use Moose::Role;
    use MooseX::Aliases;

    has this => (
        isa   => 'Str',
        is    => 'rw',
        traits => [qw(Aliased)],
        alias => 'that',
    );

    sub foo { my $self = shift; print $self->that }
    alias bar => 'foo';

DESCRIPTION

The MooseX::Aliases module will allow you to quickly alias methods in Moose. It provides an alias parameter for has() to generate aliased accessors as well as the standard ones. Attributes can also be initialized in the constructor via their aliased names.

EXPORTS

alias ALIAS METHODNAME

Installs ALIAS as a method that is aliased to the method METHODNAME.

BUGS/CAVEATS

Currently, to use MooseX::Aliased in a role, you will need to explicitly associate the metaclass trait with your attribute. This is because Moose won't automatically apply metaclass traits to attributes in roles. The example in SYNOPSIS should work.

The order of arguments for the alias method has changed (as of version 0.05). I think the new order makes more sense, and it will make future refactoring I have in mind easier. The old order still works (although it gives a deprecation warning), unless you were relying on being able to override an existing method with an alias - this will now override in the other direction. The old argument order will be removed in a future release.

Please report any bugs through RT: email bug-moosex-aliases at rt.cpan.org, or browse to http://rt.cpan.org/NoAuth/ReportBug.html?Queue=MooseX-Aliases.

SEE ALSO

Moose

Method::Alias

SUPPORT

You can find this documentation for this module with the perldoc command.

    perldoc MooseX::Aliases

You can also look for information at:

AUTHORS

  Jesse Luehrs <doy at tozt dot net>

  Chris Prather (chris@prather.org)

  Justin Hunter <justin.d.hunter at gmail dot com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2009 by Jesse Luehrs.

This is free software; you can redistribute it and/or modify it under the same terms as perl itself.