https://github.com/mohawk2/moox-thunking
Moo extension allowing attributes to be "thunked"
https://github.com/mohawk2/moox-thunking
Last synced: 8 months ago
JSON representation
Moo extension allowing attributes to be "thunked"
- Host: GitHub
- URL: https://github.com/mohawk2/moox-thunking
- Owner: mohawk2
- Created: 2017-09-06T05:11:57.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-03-21T20:14:18.000Z (about 7 years ago)
- Last Synced: 2025-03-30T03:43:02.219Z (about 1 year ago)
- Language: Perl
- Homepage: https://metacpan.org/release/MooX-Thunking
- Size: 14.6 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: Changes
Awesome Lists containing this project
README
# NAME
MooX::Thunking - Allow Moo attributes to be "thunked"
# SYNOPSIS
package Thunking;
use Moo;
use MooX::Thunking;
use Types::TypeTiny -all;
use Types::Standard -all;
has children => (
is => 'thunked',
isa => CodeLike | ArrayRef[InstanceOf['Thunking']],
required => 1,
);
package main;
my $obj;
$obj = Thunking->new(children => sub { [$obj] });
# DESCRIPTION
This is a [Moo](https://metacpan.org/pod/Moo) extension. It allows another value for the `is`
parameter to ["has" in Moo](https://metacpan.org/pod/Moo#has): "thunked". If used, this will allow you to
transparently provide either a real value for the attribute, or a
["CodeLike" in Types::TypeTiny](https://metacpan.org/pod/Types::TypeTiny#CodeLike) that when called will return such a real
value.
# AUTHOR
Ed J
# LICENCE
The same terms as Perl itself.