Why not adopt me?
NAME
MooseX::Aliases - easy aliasing of methods and attributes in Moose
VERSION
version 0.01
SYNOPSIS
package MyApp;
use Moose;
use MooseX::Aliases;
has this => (
isa => 'Str',
is => 'rw',
alias => 'that',
);
sub foo { say $self->that }
alias foo => 'bar';
$o = MyApp->new();
$o->this('Hello World');
$o->bar; # prints 'Hello World'
or
package MyApp::Role;
use Moose::Role;
has this => (
isa => 'Str',
is => 'rw',
traits => [qw(Aliased)],
alias => 'that',
);
sub foo { say $self->that }
alias foo => 'bar';
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.
EXPORTS
alias METHODNAME ALIAS
Gives the METHODNAME method an alias of ALIAS.
TODO
Subsume MooseX::MultiInitArgs, make it so that init_arg can take an ArrayRef has foo => ( init_arg => [qw(foo bar baz)], )
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.
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
SUPPORT
You can find this documentation for this module with the perldoc command.
perldoc MooseX::Aliases
You can also look for information at:
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
RT: CPAN's request tracker
Search CPAN
AUTHOR
Jesse Luehrs <doy at tozt dot net>
Chris Prather (chris@prather.org)
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.