1SQL::Translator::Role::ULsiesrtACtotnrt(r3i)buted Perl DSoQcLu:m:eTnrtaantsiloantor::Role::ListAttr(3)
2
3
4
6 SQL::Translator::Role::ListAttr - context-sensitive list attributes
7
9 package Foo;
10 use Moo;
11 use SQL::Translator::Role::ListAttr;
12
13 with ListAttr foo => ( uniq => 1, append => 1 );
14
16 This package provides a variable Moo::Role for context-sensitive list
17 attributes.
18
20 ListAttr $name => %parameters;
21 Returns a Moo::Role providing an arrayref attribute named $name, and
22 wrapping the accessor to provide context-sensitivity both for setting
23 and getting. If no "builder" or "default" is provided, the default
24 value is the empty list.
25
26 On setting, the arguments are parsed using "parse_list_arg" in
27 SQL::Translator::Utils, and the accessor will return an array reference
28 or a list, depending on context.
29
30 Parameters
31
32 append
33 If true, the setter will append arguments to the existing ones,
34 rather than replacing them.
35
36 uniq
37 If true, duplicate items will be removed, keeping the first one
38 seen.
39
40 may_throw
41 If accessing the attribute might throw an exception (e.g. from a
42 "builder" or "isa" check), this should be set to make the accessor
43 store the exception using SQL::Translator::Role::Error and return
44 undef.
45
46 undef_if_empty
47 If true, and the list is empty, the accessor will return "undef"
48 instead of a reference to an empty in scalar context.
49
50 Unknown parameters are passed through to the has call for the
51 attribute.
52
54 SQL::Translator::Utils
55 SQL::Translator::Role::Error
56
57
58
59perl v5.34.1 2022-05-10SQL::Translator::Role::ListAttr(3)