in reply to Easy cloning leaving out selected attributes
Documentation for MooseX::Clone is pretty clear about that, add 'NoClone' trait to attributes you don't want to clone:
use 5.010; use strict; use warnings; { package Foo; use Moose; with 'MooseX::Clone'; has bar => ( is => 'rw', default => 42, ); has baz => ( is => 'rw', default => 42, traits => [qw(NoClone)], ) +; } my $foo = Foo->new( bar => 33, baz => 33 ); my $clone = $foo->clone; say "Bar: ", $clone->bar; say "Baz: ", $clone->baz; __END__ Bar: 33 Baz: 42
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Easy cloning leaving out selected attributes
by mzedeler (Pilgrim) on Apr 18, 2012 at 11:31 UTC |