NAME
MooX::Role::CloneSet::BuildArgs - create updated copies of truly immutable objects
SYNOPSIS
package Someone;
use Moo;
with 'MooX::Role::CloneSet::BuildArgs';
has name => (
is => 'ro',
);
has race => (
is => 'ro',
);
package main;
my $first = Someone->new(name => 'Drizzt', race => 'drow');
my $hybrid = $first->cset(race => 'dwarf');
my $final = $weird->cset(name => 'Catti-brie', race => 'human');
DESCRIPTION
MooX::Role::CloneSet::BuildArgs
is a role very similar to MooX::Role::CloneSet
; the only difference is that its cset()
method does not try to obtain the current values of the object's attributes, but uses the ones the object was constructed with (using MooX::BuildArgs
).
METHODS
cset(field => value, ...)
Shallowly clone the object, making the specified changes to its attributes.
Note that this method obtains the names and values of the object's attributes by using the
build_args()
method fromMooX::BuildArgs
; thus, it really depends on the fact that none of the attributes has had its value changed since the object was constructed.
LICENSE
Copyright (C) 2016 Peter Pentchev <roam@ringlet.net>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
AUTHOR
Peter Pentchev <roam@ringlet.net>