• Stars
    star
    7
  • Rank 2,278,525 (Top 46 %)
  • Language
    Perl
  • License
    Other
  • Created over 12 years ago
  • Updated almost 11 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Class::Accessor::Lite with lazy accessor feature

NAME

Class::Accessor::Lite::Lazy - Class::Accessor::Lite with lazy accessor feature

SYNOPSIS

package MyPackage;

use Class::Accessor::Lite::Lazy (
    rw_lazy => [
      # implicit builder method name is "_build_foo"
      qw(foo foo2),
      # or specify builder explicitly
      {
        xxx => 'method_name',
        yyy => sub {
          my $self = shift;
          ...
        },
      }
    ],
    ro_lazy => [ qw(bar) ],
    # Class::Accessor::Lite functionality is also available
    new => 1,
    rw  => [ qw(baz) ],
);

# or if you specify all attributes' builders explicitly
use Class::Accessor::Lite::Lazy (
    rw_lazy => {
      foo => '_build_foo',
      bar => \&_build_bar,
    }
);

sub _build_foo {
    my $self = shift;
    ...
}

sub _build_bar {
    my $self = shift;
    ...
}

DESCRIPTION

Class::Accessor::Lite::Lazy provides a "lazy" accessor feature to Class::Accessor::Lite.

If a lazy accessor without any value set is called, a builder method is called to generate a value to set.

THE USE STATEMENT

As Class::Accessor::Lite, the use statement provides the way to create lazy accessors.

  • rw_lazy => \@name_of_the_properties | \%properties_and_builders

    Creates read / write lazy accessors.

  • ro_lazy => \@name_of_the_properties | \%properties_and_builders

    Creates read-only lazy accessors.

  • new, rw, ro, wo

    Same as Class::Accessor::Lite.

FUNCTIONS

  • Class::Accessor::Lite::Lazy->mk_lazy_accessors(@name_of_the_properties)

    Creates lazy accessors in current package.

  • Class::Accessor::Lite::Lazy->mk_ro_lazy_accessors(@name_of_the_properties)

    Creates read-only lazy accessors in current package.

SPECIFYING BUILDERS

As seen in SYNOPSIS, each attribute is specified by either a string or a hashref.

In the string form $attr you specify builders implicitly, the builder method name for the attribute $attr is named _build_$attr.

In the hashref form { $attr => $method_name | \&builder } you can explicitly specify builders, each key is the attribute name and each value is either a string which specifies the builder method name or a coderef itself.

AUTHOR

motemen [email protected]

SEE ALSO

Class::Accessor::Lite

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

More Repositories

1

git-vim

My vim files for Git
Vim Script
576
star
2

gompatible

A tool to show Go package's API changes between two (git) revisions
Go
173
star
3

go-loghttp

Go library to log http.Client's requests and responses automatically
Go
107
star
4

minimatch-cheat-sheet

A cheat sheet for minimatch
JavaScript
98
star
5

lgtm.sh

The fastest way to generate animated LGTM images
Shell
68
star
6

git-browse-remote

Open web browser to view remote Git repositories
Ruby
59
star
7

gas-cronsheet-slack

Google Apps Script to use spreadsheet for timed posts to Slack
JavaScript
53
star
8

go-pocket

Pocket (getpocket.com) API client for Go (golang).
Go
50
star
9

gofind

gofind searches through Go source code by types.
Go
48
star
10

Wight

Communicate with PhantomJS in Perl (Capybara+Poltergeist to Perl)
Perl
48
star
11

go-for-go-book

WIP
Ruby
48
star
12

github-list-starred

List GitHub repositories starred by a user
Go
48
star
13

polka

Web DJ
JavaScript
42
star
14

Teto

nicovideo stream player
Perl
40
star
15

prchecklist

Provides checklists based on release PR
Go
37
star
16

yaruo

やる夫で学ぶシリーズ
Ruby
37
star
17

go-sqlf

Simple and obvious Printf-like SQL generator
Go
37
star
18

gas-slack-log-spreadsheet

TypeScript
36
star
19

go-typeswitch-gen

Expands type switches with type variables to achieve generic functions in Golang
Go
34
star
20

go-iferr

Smartly inserts idiomatic "err" handling code in Go
Go
34
star
21

gcal-tui

Go
31
star
22

go-quickfix

Quick fix non-compiling well-typed Go source code e.g. "x declared and not used."
Go
31
star
23

go-cli

Yet another CLI app builder with commands, based on documentation.
Go
30
star
24

dts-google-apps-script

d.ts files for Google Apps Script
JavaScript
29
star
25

slack-stream-json

Rust
28
star
26

hatena-vim

Vim scripts for posting/updating hatena diary/group
Vim Script
27
star
27

go-testutil

Go
27
star
28

App-htmlcat

redirect stdin to web browser
Perl
27
star
29

Plack-Middleware-WebSocket

WebSocket handshake helper middleware
Perl
26
star
30

xslate-vim

Vim Script
25
star
31

arrow-js

Equip JavaScript with arrows
JavaScript
20
star
32

android-PicTumblr

Android app for Tumblr picture reblogging
Scala
19
star
33

github-userscripts

GitHub userscripts
JavaScript
19
star
34

furoshiki2

Python
18
star
35

go-nuts

Go code I want sometimes but too small to be a separate library
Go
17
star
36

TextCast

TypeScript
17
star
37

go-graphql-query

Go
16
star
38

git-log-relay-chat

chat on git commit log
Perl
15
star
39

example-scrape-websites

Examples scripts to scrape websites
JavaScript
15
star
40

modoi

nijiura proxy
Perl
14
star
41

chrome-Flavoured-Favicon

Change color tastes of favicons by their domains
TypeScript
14
star
42

gas-google-calendar-to-slack-status-farm

JavaScript
14
star
43

homebrew-ghq

DEPREACATED: please use homebrew-core
Ruby
14
star
44

Kindlenap

Generate HTML files suitable for kindlegen.
Perl
13
star
45

git-unify

Share .git directory among local repositories of same origin
Shell
13
star
46

go-colorine

A simple colorized console logger
Go
12
star
47

pusheen-explorer

Explore Pusheen Pics!
JavaScript
12
star
48

chrome-GitHub-Issue-Badges

Chrome extension to embed GitHub Issue Badge's into GitHub issues
TypeScript
11
star
49

go-ctxize

Rewrite functions to have "Context"s
Go
11
star
50

go-gitconfig

Go library for loading git config
Go
11
star
51

AnyEvent-DAAP-Server

DAAP server implemented on AnyEvent
Perl
11
star
52

as3-klt

Kanade-Lucas-Tomasi feature tracker implementation in as3
ActionScript
11
star
53

jusk

Haskell implemented JavaScript interpreter
Haskell
10
star
54

Travel-Handbook

旅の栞
10
star
55

gobin.cc

Go
9
star
56

vim-help-random

a Vim plugin to open a help topic randomly
Vim Script
9
star
57

sketch-eth-pay-for-content

JavaScript
9
star
58

image-opencv

Perl interface for opencv library
C
9
star
59

mir

Go
8
star
60

chrome-extension-esbuild

TypeScript
8
star
61

hub-pr

Personal workflow handling GitHub Pull Requests
Go
8
star
62

adsense-report-menubar

AdSense performance report on the menubar
TypeScript
8
star
63

hatena-welcome-speech

8
star
64

sbx

An unofficial Scrapbox client
Go
8
star
65

futimer

Web-based speedcubing timer
TypeScript
7
star
66

docker-julius

Dockerfile for Julius and its dictation kit.
Shell
7
star
67

gas-TaskCal

TypeScript
7
star
68

docker-mod_perl

Dockerfile
7
star
69

forward2docker

Easily build and start a docker container and set up port forwardings to it, using boot2docker
Shell
7
star
70

adsense-report-cli

Generate Google Adsense's report in your terminal
Go
7
star
71

chrome-meet-mute-toggler

Easily toggle your microphone mutes on Google Meet meetings, by clicking toolbar button.
TypeScript
7
star
72

macos-BluetoothAudioDistancer

Swift
6
star
73

perl5-Print-Indented

Outputs indented as per source code indentation
Perl
6
star
74

node-humr

Makes input lines into human-readable ones
TypeScript
6
star
75

tap-vim

TAP (Test Anything Protocol) parser
Vim Script
6
star
76

wercker-box-golang-goxc

Wercker box for cross-compiling Go using goxc
6
star
77

App-sn

Command-line Simplenote client
Perl
6
star
78

github-commit-status-mark

View GitHub's commit status on your terminal, ✗●✓
Go
5
star
79

webextension-obfuscate-texts

TypeScript
5
star
80

qiita-dl

Go
5
star
81

kao-vault

my kaomoji collection
5
star
82

example-go-bubbletea

Go
5
star
83

HTTP-Response-Maker

easy HTTP response object maker functions
Perl
5
star
84

pocket-expose-web

Creates public feeds of Pocket list
Go
5
star
85

dotfiles

My dotfiles
Vim Script
5
star
86

Warg

Downloader
Perl
5
star
87

git-hub-sync-repo-info

Synchronize .git/description and .git/homepage files with GitHub repository's info
Ruby
5
star
88

vim-guess-abbrev

expand input dynamically http://subtech.g.hatena.ne.jp/motemen/20101215/1292414533
Vim Script
5
star
89

long-weekends-ng

JavaScript
5
star
90

perl5-Test-Retry

Retry a code block for several times until a test function succeeds
Perl
5
star
91

stablediffusion-server-on-colab

Jupyter Notebook
5
star
92

go-switchgen

Go
5
star
93

lambda-calculator

Scala
4
star
94

goreadme

Easy templating Go package READMEs
Go
4
star
95

webusurai

TypeScript
4
star
96

android-AnimeFaceDemo

Imager::AnimeFace android port test
C
4
star
97

web-year-progress

TypeScript
4
star
98

perl5-Test-Deep-JSON

Provide json() function for Test::Deep comparison
Perl
4
star
99

beautiful-graph-maker

JavaScript
4
star
100

WebService-8tracks

Handle 8tracks API
Perl
4
star