09 Jun 2013 02:28:55 UTC
- Distribution: MooseX-MultiInitArg
- Module version: 0.02
- Source (raw)
- Browse (raw)
- How to Contribute
- Repository (git clone)
- Issues (0)
- Testers (1996 / 10 / 0)
- KwaliteeBus factor: 0
- 100.00% Coverage
- License: perl_5
- Activity24 month
- Download (10.06KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest versionFRODWITH Paul Driverand 1 contributors
- Paul Driver, C<< <frodwith at cpan.org> >>
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.
<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.
Module Install Instructions
To install MooseX::MultiInitArg, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install MooseX::MultiInitArg
For more information on module installation, please visit the detailed CPAN module installation guide.