Rechercher une page de manuel
MooseX::Aliases.3pm
Langue: en
Version: 2010-01-17 (ubuntu - 24/10/10)
Section: 3 (Bibliothèques de fonctions)
Sommaire
NAME
MooseX::Aliases - easy aliasing of methods and attributes in MooseVERSION
version 0.08SYNOPSIS
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
MooseMethod::Alias
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
<http://annocpan.org/dist/MooseX-Aliases>
- •
- CPAN Ratings
<http://cpanratings.perl.org/d/MooseX-Aliases>
- •
- RT: CPAN's request tracker
<http://rt.cpan.org/NoAuth/Bugs.html?Dist=MooseX-Aliases>
- •
- Search CPAN
<http://search.cpan.org/dist/MooseX-Aliases>
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.
Contenus ©2006-2024 Benjamin Poulain
Design ©2006-2024 Maxime Vantorre