-
-
06 Jul 2016 22:11:23 UTC
- Distribution: Mo
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues (12)
- Testers (8971 / 7 / 0)
- Kwalitee
Bus factor: 2- 93.85% Coverage
- License: perl_5
- Perl: v5.6.0
- Activity
24 month- Tools
- Download (39.19KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- none
- Reverse dependencies
- CPAN Testers List
- Dependency graph
Name
Mo::builder - Adds the builder feature to Mo's has
Synopsis
use Mo qw'builder'; 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 qw'builder'; 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 qw'builder nonlazy'; has status => ( builder => '_build_status' ); # eager has source => ( builder => '_build_source', lazy => 1); # lazy has target => ( builder => '_build_target', lazy => 0); # eager
Module Install Instructions
To install Mo, copy and paste the appropriate command in to your terminal.
cpanm Mo
perl -MCPAN -e shell install Mo
For more information on module installation, please visit the detailed CPAN module installation guide.