.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "SQL::Translator::Role::ListAttr 3pm" .TH SQL::Translator::Role::ListAttr 3pm 2024-01-20 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME SQL::Translator::Role::ListAttr \- context\-sensitive list attributes .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 3 \& package Foo; \& use Moo; \& use SQL::Translator::Role::ListAttr; \& \& with ListAttr foo => ( uniq => 1, append => 1 ); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" This package provides a variable Moo::Role for context-sensitive list attributes. .SH FUNCTIONS .IX Header "FUNCTIONS" .ie n .SS "ListAttr $name => %parameters;" .el .SS "ListAttr \f(CW$name\fP => \f(CW%parameters\fP;" .IX Subsection "ListAttr $name => %parameters;" Returns a Moo::Role providing an arrayref attribute named \f(CW$name\fR, and wrapping the accessor to provide context-sensitivity both for setting and getting. If no \f(CW\*(C`builder\*(C'\fR or \f(CW\*(C`default\*(C'\fR is provided, the default value is the empty list. .PP On setting, the arguments are parsed using "parse_list_arg" in SQL::Translator::Utils, and the accessor will return an array reference or a list, depending on context. .PP \fIParameters\fR .IX Subsection "Parameters" .IP append 4 .IX Item "append" If true, the setter will append arguments to the existing ones, rather than replacing them. .IP uniq 4 .IX Item "uniq" If true, duplicate items will be removed, keeping the first one seen. .IP may_throw 4 .IX Item "may_throw" If accessing the attribute might throw an exception (e.g. from a \f(CW\*(C`builder\*(C'\fR or \f(CW\*(C`isa\*(C'\fR check), this should be set to make the accessor store the exception using SQL::Translator::Role::Error and return undef. .IP undef_if_empty 4 .IX Item "undef_if_empty" If true, and the list is empty, the accessor will return \f(CW\*(C`undef\*(C'\fR instead of a reference to an empty in scalar context. .PP Unknown parameters are passed through to the has call for the attribute. .SH "SEE ALSO" .IX Header "SEE ALSO" .IP SQL::Translator::Utils 4 .IX Item "SQL::Translator::Utils" .PD 0 .IP SQL::Translator::Role::Error 4 .IX Item "SQL::Translator::Role::Error"