NAME
MooseX::HandlesConstructor - Moo[se] extension that allows for setting handle accessors with the constructor
VERSION
version 0.001
SYNOPSIS
package
Message;
use
MooX::HandlesVia;
has
header
=> (
is
=>
'rw'
,
default
=>
sub
{ {} },
handles_via
=>
'Hash'
,
handles
=> {
session
=> [
accessor
=>
'session'
],
msg_type
=> [
accessor
=>
'msg_type'
]
}
);
# elsewhere...
my
$msg
= Message->new(
msg_type
=>
'reply'
,
header
=> {
answer
=> 42 } );
# $VAR1 = {
# 'answer' => 42,
# 'msg_type' => 'reply'
# };
DESCRIPTION
When using Moo or Moose handles that provide an accessor handle on an attribute, it may make sense to pass the name of handles to the constructor to simplify the API. Using this module will get all curried accessor handles defined in a class and allow setting them when calling -
new()>
SEE ALSO
MooX::HandlesVia, Moose native delegation.
AUTHOR
Zakariyya Mughal <zmughal@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2014 by Zakariyya Mughal.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.