MooX::Role::CloneSet::BuildArgs3pm
Create updated copies of truly immutable objects
Usage
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');
Overview
"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 from"MooX::BuildArgs"; thus, it really depends on the fact that none of the attributes has had its value changed since the object was constructed.
Releases
5 releases since Debian 9 (Stretch); the text changed 3 times.