Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
MooX::Aliases(3)      User Contributed Perl Documentation     MooX::Aliases(3)

NAME
       MooX::Aliases - easy aliasing of	methods	and attributes in Moo

SYNOPSIS
	 package MyClass;
	 use Moo;
	 use MooX::Aliases;

	 has this => (
	     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 MyRole;
	 use Moo::Role;
	 use MooX::Aliases;

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

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

DESCRIPTION
       The MooX::Aliases module	will allow you to quickly alias	methods	in
       Moo. 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.

       You can create more than	one alias at once by passing a listref:

	 has ip_addr =>	(
	   alias => [ qw(ipAddr	ip) ],
	 );

FUNCTIONS
       alias $alias, $method
	   Creates $alias as a method that is aliased to $method.

CAVEATS
       This module uses	the "BUILDARGS"	to map the attributes.	If a class
       uses a custom "BUILDARGS", this module may not behave properly.

SEE ALSO
       MooseX::Aliases

AUTHOR
       haarg - Graham Knop (cpan:HAARG)	<haarg@haarg.org>

   CONTRIBUTORS
       o       Chris Prather <chris@prather.org>

       o       Jesse Luehrs <doy@tozt.net>

       o       Justin Hunter <justin.d.hunter@gmail.com>

       o       Karen Etheridge <ether@cpan.org>

       o       Yuval Kogman <nothingmuch@woobling.org>

       o       Daniel Gempesaw <gempesaw@gmail.com>

       o       Denis Ibaev <dionys@gmail.com>

COPYRIGHT
       Copyright (c) 2013 the MooX::Alises "AUTHOR" and	"CONTRIBUTORS" as
       listed above.

LICENSE
       This library is free software and may be	distributed under the same
       terms as	perl itself.

perl v5.32.0			  2015-02-01		      MooX::Aliases(3)

NAME | SYNOPSIS | DESCRIPTION | FUNCTIONS | CAVEATS | SEE ALSO | AUTHOR | COPYRIGHT | LICENSE

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=MooX::Aliases&sektion=3&manpath=FreeBSD+12.2-RELEASE+and+Ports>

home | help