Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jhthorsen/class-accessor-fast-withbuilder
class-accessor module with _build_foo() default value providers
https://github.com/jhthorsen/class-accessor-fast-withbuilder
Last synced: 27 days ago
JSON representation
class-accessor module with _build_foo() default value providers
- Host: GitHub
- URL: https://github.com/jhthorsen/class-accessor-fast-withbuilder
- Owner: jhthorsen
- Created: 2011-01-01T19:52:10.000Z (almost 14 years ago)
- Default Branch: master
- Last Pushed: 2013-10-01T10:32:10.000Z (over 11 years ago)
- Last Synced: 2024-10-16T11:58:43.050Z (3 months ago)
- Language: Perl
- Homepage:
- Size: 108 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README
- Changelog: Changes
Awesome Lists containing this project
README
NAME
Class::Accessor::Fast::WithBuilder - Class::Accessor::Fast with lazy
defaultsVERSION
0.0101DESCRIPTION
This module will require builders for each attribute defined. This means
that adding attributes with this module, is something like this code
from Moose:has age => (
is => "ro", # or rw
lazy => 1,
builder => "_build_age",
);NOTE: All builders will be called as late as possible.
SYNOPSIS
package Foo;
use base qw(Class::Accessor::Fast::WithBuilder);Foo->mk_accessors(qw( name age ));
sub _build_name { $_[0]->_croak("'name' attribute cannot be built!") }
sub _build_age { 0 }print Foo->new->name; # BOOM!
print Foo->new->age; # Will print "0"
print Foo->new({ age => 123 })->age; # Will print "123"METHODS
make_accessor
See "make_accessor" in Class::Accessormake_ro_accessor
See "make_ro_accessor" in Class::Accessormake_wo_accessor
This is not implemented. (See "make_wo_accessor" in Class::Accessor)COPYRIGHT & LICENSE
AUTHOR
Jan Henning Thorsen "jhthorsen at cpan.org"