1MooseX::Aliases(3)    User Contributed Perl Documentation   MooseX::Aliases(3)
2
3
4

NAME

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

VERSION

9       version 0.10
10

SYNOPSIS

12           package MyApp;
13           use Moose;
14           use MooseX::Aliases;
15
16           has this => (
17               isa   => 'Str',
18               is    => 'rw',
19               alias => 'that',
20           );
21
22           sub foo { my $self = shift; print $self->that }
23           alias bar => 'foo';
24
25           my $o = MyApp->new();
26           $o->this('Hello World');
27           $o->bar; # prints 'Hello World'
28
29       or
30
31           package MyApp::Role;
32           use Moose::Role;
33           use MooseX::Aliases;
34
35           has this => (
36               isa   => 'Str',
37               is    => 'rw',
38               alias => 'that',
39           );
40
41           sub foo { my $self = shift; print $self->that }
42           alias bar => 'foo';
43

DESCRIPTION

45       The MooseX::Aliases module will allow you to quickly alias methods in
46       Moose. It provides an alias parameter for "has()" to generate aliased
47       accessors as well as the standard ones. Attributes can also be
48       initialized in the constructor via their aliased names.
49
50       You can create more than one alias at once by passing a listref:
51
52           has ip_addr => (
53               alias => [ qw(ipAddr ip) ],
54           );
55

FUNCTIONS

57   alias ALIAS METHODNAME
58       Installs ALIAS as a method that is aliased to the method METHODNAME.
59

CAVEATS

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

BUGS

70       No known bugs.
71
72       Please report any bugs through RT: email "bug-moosex-aliases at
73       rt.cpan.org", or browse to
74       http://rt.cpan.org/NoAuth/ReportBug.html?Queue=MooseX-Aliases
75       <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=MooseX-Aliases>.
76

SEE ALSO

78       ·   Moose
79
80       ·   Method::Alias
81

SUPPORT

83       You can find this documentation for this module with the perldoc
84       command.
85
86           perldoc MooseX::Aliases
87
88       You can also look for information at:
89
90       ·   AnnoCPAN: Annotated CPAN documentation
91
92           http://annocpan.org/dist/MooseX-Aliases
93           <http://annocpan.org/dist/MooseX-Aliases>
94
95       ·   CPAN Ratings
96
97           http://cpanratings.perl.org/d/MooseX-Aliases
98           <http://cpanratings.perl.org/d/MooseX-Aliases>
99
100       ·   RT: CPAN's request tracker
101
102           http://rt.cpan.org/NoAuth/Bugs.html?Dist=MooseX-Aliases
103           <http://rt.cpan.org/NoAuth/Bugs.html?Dist=MooseX-Aliases>
104
105       ·   Search CPAN
106
107           http://search.cpan.org/dist/MooseX-Aliases
108           <http://search.cpan.org/dist/MooseX-Aliases>
109

AUTHORS

111       ·   Jesse Luehrs <doy at tozt dot net>
112
113       ·   Chris Prather <chris@prather.org>
114
115       ·   Justin Hunter <justin.d.hunter at gmail dot com>
116
118       This software is copyright (c) 2011 by Jesse Luehrs.
119
120       This is free software; you can redistribute it and/or modify it under
121       the same terms as the Perl 5 programming language system itself.
122
123
124
125perl v5.12.3                      2011-04-29                MooseX::Aliases(3)
Impressum