MooseX::MultiInitArg(3pm)

MooseX::MultiInitArg3pm

Attributes with aliases for constructor arguments.

Usage

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

Overview

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.

Releases

8 releases since Debian 6.0 (Squeeze); the text changed 3 times.

  1. 6.0–7
  2. 8–9
  3. 10–11
  4. 12–13

Author

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

From libmoosex-multiinitarg-perl 0.02-3 in Debian 13 (Trixie). Parsed by carta from the page's man source.