# || confess "You must specify a format role in order to use an IO role";
push @roles => 'MooseX::Storage::IO::' . $params{'io'};
}
+
+ # Note:
+ # These traits alter the behaviour of the engine, the user can
+ # specify these per role-usage
+ for my $trait ( @{ $params{'traits'} ||= [] } ) {
+ push @roles, 'MooseX::Storage::Traits::'.$trait;
+ }
Class::MOP::load_class($_)
|| die "Could not load role (" . $_ . ")"
=back
+=head2 Behaviour modifiers
+
+The serialization behaviour can be changed by supplying C<traits>.
+This can be done as follows:
+
+ use MooseX::Storage;
+ with Storage( traits => [Trait1, Trait2,...] );
+
+The following traits are currently bundled with C<MooseX::Storage>:
+
+=over 4
+
+=item OnlyWhenBuilt
+
+Only attributes that have been built (ie, where the predicate returns
+'true') will be serialized. This avoids any potentially expensive computations.
+
+See L<MooseX::Storage::Traits::OnlyWhenBuilt> for details.
+
+=back
+
=head2 How we serialize
There are always limits to any serialization framework, there are just