Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kentnl/moox-lsub
Very shorthand syntax for bulk lazy builders
https://github.com/kentnl/moox-lsub
perl
Last synced: 4 days ago
JSON representation
Very shorthand syntax for bulk lazy builders
- Host: GitHub
- URL: https://github.com/kentnl/moox-lsub
- Owner: kentnl
- License: other
- Created: 2014-07-06T00:12:41.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-03-03T14:19:13.000Z (over 7 years ago)
- Last Synced: 2024-06-19T06:56:26.455Z (5 months ago)
- Topics: perl
- Language: Perl
- Size: 112 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.mkdn
- Changelog: Changes
- License: LICENSE
Awesome Lists containing this project
README
# NAME
MooX::Lsub - Very shorthand syntax for bulk lazy builders
# VERSION
version 0.002002
# SYNOPSIS
use MooX::Lsub;
# Shorthand for
# has foo => ( is => ro =>, lazy => 1, builder => '_build_foo' );
# sub _build_foo { "Hello" }lsub foo => sub { "Hello" };
# DESCRIPTION
I often want to use a lot of lazy build subs to implement some plumbing, with scope to allow
it to be overridden by people who know what they're doing with an injection library like Bread::Board.Usually, the syntax of `Class::Tiny` is what I use for such things.
use Class::Tiny {
'a' => sub { },
'b' => sub { },
};Etc.
But switching things to Moo means I usually have to get much uglier, and repeat myself a \*lot\*.
So this module exists as a compromise.
Additionally, I always forgot to declare `use Moo 1.000008` which was the first version of `Moo` where
`builder => sub` worked, and I would invariably get silly test failures in smokers as a consequence.This module avoids such problem entirely, and is tested to work with `Moo 0.009001`.
# AUTHOR
Kent Fredric
# COPYRIGHT AND LICENSE
This software is copyright (c) 2017 by Kent Fredric .
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.