GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  MO::BUILDER (3)

.ds Aq ’

Name

Mo::builder - Adds the builder feature to Mo’s has

CONTENTS

Synopsis



    use Mo qwbuilder;
    has name => ( builder => name_lookup );

    sub name_lookup {
        my ($self) = @_;
        ...
    }



Description

Adds the builder parameter to has, which expects a method name, which is executed on $self to set the attribute if it hasn’t been set yet.

Laziness

Builders in Mo are lazy by default. This can be changed by explicitly setting the lazy argument to false, in order to cause it to be initialized during instantiation.



    use Mo qwbuilder;
    has status => ( builder => _build_status );             # lazy
    has source => ( builder => _build_source, lazy => 1);   # lazy
    has target => ( builder => _build_target, lazy => 0);   # eager



To change the default behavior and make builders to be initialized eagerly by default, import nonlazy.



    use Mo qwbuilder nonlazy;
    has status => ( builder => _build_status );             # eager
    has source => ( builder => _build_source, lazy => 1);   # lazy
    has target => ( builder => _build_target, lazy => 0);   # eager



Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 MO::BUILDER (3) 2014-09-04

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.