GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
MooX::Aliases(3) User Contributed Perl Documentation MooX::Aliases(3)

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

  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';

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) ],
  );

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

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

MooseX::Aliases

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

  • Chris Prather <chris@prather.org>
  • Jesse Luehrs <doy@tozt.net>
  • Justin Hunter <justin.d.hunter@gmail.com>
  • Karen Etheridge <ether@cpan.org>
  • Yuval Kogman <nothingmuch@woobling.org>
  • Daniel Gempesaw <gempesaw@gmail.com>
  • Denis Ibaev <dionys@gmail.com>

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

This library is free software and may be distributed under the same terms as perl itself.
2015-02-01 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.