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
MooseX::MultiInitArg(3) User Contributed Perl Documentation MooseX::MultiInitArg(3)

MooseX::MultiInitArg - Attributes with aliases for constructor arguments.

  package Thinger;
  use Moose;
        use MooseX::MultiInitArg;
  
  has 'data' => (
      metaclass => 'MultiInitArg',

      # For composability, you could use the following:
      # traits => ['MooseX::MultiInitArg::Trait'],

      is        => 'ro',
      isa       => 'Str',
      init_args => [qw(munge frobnicate)],
  );

  package main;

  # All these are equivalent
  my $foo = Thinger->new(data => 'foo');
  my $foo = Thinger->new(munge => 'foo');
  my $foo = Thinger->new(frobnicate => 'foo');

If you've ever wanted to be able to call an attribute any number of things while you're passing arguments to your object constructor, Now You Can.

The primary motivator is that I have some attributes that were named inconsistently, and I wanted to rename them without breaking backwards compatibility with my existing API.

Paul Driver, "<frodwith at cpan.org>"

Copyright 2007-2013 by Paul Driver.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

2013-06-09 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.