README.md
1# NAME
2
3MooX::Thunking - Allow Moo attributes to be "thunked"
4
5# SYNOPSIS
6
7 package Thunking;
8 use Moo;
9 use MooX::Thunking;
10 use Types::TypeTiny -all;
11 use Types::Standard -all;
12 has children => (
13 is => 'thunked',
14 isa => CodeLike | ArrayRef[InstanceOf['Thunking']],
15 required => 1,
16 );
17
18 package main;
19 my $obj;
20 $obj = Thunking->new(children => sub { [$obj] });
21
22# DESCRIPTION
23
24This is a [Moo](https://metacpan.org/pod/Moo) extension. It allows another value for the `is`
25parameter to ["has" in Moo](https://metacpan.org/pod/Moo#has): "thunked". If used, this will allow you to
26transparently provide either a real value for the attribute, or a
27["CodeLike" in Types::TypeTiny](https://metacpan.org/pod/Types::TypeTiny#CodeLike) that when called will return such a real
28value.
29
30# AUTHOR
31
32Ed J
33
34# LICENCE
35
36The same terms as Perl itself.
37