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


MooseX-MultiInitArg documentation Contained in the MooseX-MultiInitArg distribution.

Index


Code Index:

NAME

Top

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

SYNOPSIS

Top

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

DESCRIPTION

Top

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.

AUTHOR

Top

Paul Driver, <frodwith at cpan.org>

COPYRIGHT AND LICENSE

Top


MooseX-MultiInitArg documentation Contained in the MooseX-MultiInitArg distribution.

package MooseX::MultiInitArg;

use strict;
use warnings;

our $VERSION = '0.01';

use MooseX::MultiInitArg::Attribute;
use MooseX::MultiInitArg::Trait;

1;

__END__