1MooseX::Storage::EngineU:s:eTrraCiotn:tM:roOionbslueytXWe:hd:eSnPtBeourrilalgtDe(o:3c:)uEmnegnitnaet:i:oTnrait::OnlyWhenBuilt(3)
2
3
4

NAME

6       MooseX::Storage::Engine::Trait::OnlyWhenBuilt - An engine trait to
7       bypass serialization
8

VERSION

10       version 0.53
11

SYNOPSIS

13           {   package Point;
14               use Moose;
15               use MooseX::Storage;
16
17               with Storage( traits => [qw|OnlyWhenBuilt|] );
18
19               has 'x' => (is => 'rw', lazy_build => 1 );
20               has 'y' => (is => 'rw', predicate => '_has_y' );
21               has 'z' => (is => 'rw', builder => '_build_z' );
22
23               sub _build_x { 3 }
24               sub _build_y { expensive_computation() }
25               sub _build_z { 3 }
26           }
27
28           my $p = Point->new( 'x' => 4 );
29
30           # the result of ->pack will contain:
31           # { x => 4, z => 3 }
32           $p->pack;
33

DESCRIPTION

35       Sometimes you don't want a particular attribute to be part of the
36       serialization if it has not been built yet. If you invoke "Storage()"
37       as outlined in the "Synopsis", only attributes that have been built
38       (i.e., where the predicate returns 'true') will be serialized.  This
39       avoids any potentially expensive computations.
40
41       This trait is applied to an instance of MooseX::Storage::Engine, for
42       the user-visible version shown in the SYNOPSIS, see
43       MooseX::Storage::Traits::OnlyWhenBuilt
44

SUPPORT

46       Bugs may be submitted through the RT bug tracker
47       <https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-Storage> (or
48       bug-MooseX-Storage@rt.cpan.org <mailto:bug-MooseX-
49       Storage@rt.cpan.org>).
50
51       There is also a mailing list available for users of this distribution,
52       at <http://lists.perl.org/list/moose.html>.
53
54       There is also an irc channel available for users of this distribution,
55       at "#moose" on "irc.perl.org" <irc://irc.perl.org/#moose>.
56

AUTHORS

58       •   Chris Prather <chris.prather@iinteractive.com>
59
60       •   Stevan Little <stevan.little@iinteractive.com>
61
62       •   יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>
63
65       This software is copyright (c) 2007 by Infinity Interactive, Inc.
66
67       This is free software; you can redistribute it and/or modify it under
68       the same terms as the Perl 5 programming language system itself.
69
70
71
72perl v5.34.0                  Moos2e0X2:1:-S0t7o-r2a2ge::Engine::Trait::OnlyWhenBuilt(3)
Impressum