.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" 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 .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . 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 .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Mouse::Meta::Attribute 3pm" .TH Mouse::Meta::Attribute 3pm "2020-11-09" "perl v5.32.0" "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" Mouse::Meta::Attribute \- The Mouse attribute metaclass .SH "VERSION" .IX Header "VERSION" This document describes Mouse version v2.5.10 .SH "DESCRIPTION" .IX Header "DESCRIPTION" This is a meta object protocol for Mouse attributes, which is a subset of Moose::Meta::Attribute. .SH "METHODS" .IX Header "METHODS" .ie n .SS """new(%options) \-> Mouse::Meta::Attribute""" .el .SS "\f(CWnew(%options) \-> Mouse::Meta::Attribute\fP" .IX Subsection "new(%options) -> Mouse::Meta::Attribute" Instantiates a new Mouse::Meta::Attribute. Does nothing else. .PP It adds the following options to the constructor: .ie n .IP """is => \*(Aqro\*(Aq, \*(Aqrw\*(Aq, \*(Aqbare\*(Aq""" 4 .el .IP "\f(CWis => \*(Aqro\*(Aq, \*(Aqrw\*(Aq, \*(Aqbare\*(Aq\fR" 4 .IX Item "is => ro, rw, bare" This provides a shorthand for specifying the \f(CW\*(C`reader\*(C'\fR, \f(CW\*(C`writer\*(C'\fR, or \&\f(CW\*(C`accessor\*(C'\fR names. If the attribute is read-only ('ro') then it will have a \f(CW\*(C`reader\*(C'\fR method with the same attribute as the name. .Sp If it is read-write ('rw') then it will have an \f(CW\*(C`accessor\*(C'\fR method with the same name. If you provide an explicit \f(CW\*(C`writer\*(C'\fR for a read-write attribute, then you will have a \f(CW\*(C`reader\*(C'\fR with the same name as the attribute, and a \f(CW\*(C`writer\*(C'\fR with the name you provided. .Sp Use 'bare' when you are deliberately not installing any methods (accessor, reader, etc.) associated with this attribute; otherwise, Moose will issue a deprecation warning when this attribute is added to a metaclass. .ie n .IP """isa => Type""" 4 .el .IP "\f(CWisa => Type\fR" 4 .IX Item "isa => Type" This option accepts a type. The type can be a string, which should be a type name. If the type name is unknown, it is assumed to be a class name. .Sp This option can also accept a Moose::Meta::TypeConstraint object. .Sp If you \fIalso\fR provide a \f(CW\*(C`does\*(C'\fR option, then your \f(CW\*(C`isa\*(C'\fR option must be a class name, and that class must do the role specified with \&\f(CW\*(C`does\*(C'\fR. .ie n .IP """does => Role""" 4 .el .IP "\f(CWdoes => Role\fR" 4 .IX Item "does => Role" This is short-hand for saying that the attribute's type must be an object which does the named role. .Sp \&\fBThis option is not yet supported.\fR .ie n .IP """coerce => Bool""" 4 .el .IP "\f(CWcoerce => Bool\fR" 4 .IX Item "coerce => Bool" This option is only valid for objects with a type constraint (\f(CW\*(C`isa\*(C'\fR). If this is true, then coercions will be applied whenever this attribute is set. .Sp You can make both this and the \f(CW\*(C`weak_ref\*(C'\fR option true. .ie n .IP """trigger => CodeRef""" 4 .el .IP "\f(CWtrigger => CodeRef\fR" 4 .IX Item "trigger => CodeRef" This option accepts a subroutine reference, which will be called after the attribute is set. .ie n .IP """required => Bool""" 4 .el .IP "\f(CWrequired => Bool\fR" 4 .IX Item "required => Bool" An attribute which is required must be provided to the constructor. An attribute which is required can also have a \f(CW\*(C`default\*(C'\fR or \f(CW\*(C`builder\*(C'\fR, which will satisfy its required-ness. .Sp A required attribute must have a \f(CW\*(C`default\*(C'\fR, \f(CW\*(C`builder\*(C'\fR or a non\-\f(CW\*(C`undef\*(C'\fR \f(CW\*(C`init_arg\*(C'\fR .ie n .IP """lazy => Bool""" 4 .el .IP "\f(CWlazy => Bool\fR" 4 .IX Item "lazy => Bool" A lazy attribute must have a \f(CW\*(C`default\*(C'\fR or \f(CW\*(C`builder\*(C'\fR. When an attribute is lazy, the default value will not be calculated until the attribute is read. .ie n .IP """weak_ref => Bool""" 4 .el .IP "\f(CWweak_ref => Bool\fR" 4 .IX Item "weak_ref => Bool" If this is true, the attribute's value will be stored as a weak reference. .ie n .IP """auto_deref => Bool""" 4 .el .IP "\f(CWauto_deref => Bool\fR" 4 .IX Item "auto_deref => Bool" If this is true, then the reader will dereference the value when it is called. The attribute must have a type constraint which defines the attribute as an array or hash reference. .ie n .IP """lazy_build => Bool""" 4 .el .IP "\f(CWlazy_build => Bool\fR" 4 .IX Item "lazy_build => Bool" Setting this to true makes the attribute lazy and provides a number of default methods. .Sp .Vb 4 \& has \*(Aqsize\*(Aq => ( \& is => \*(Aqro\*(Aq, \& lazy_build => 1, \& ); .Ve .Sp is equivalent to this: .Sp .Vb 7 \& has \*(Aqsize\*(Aq => ( \& is => \*(Aqro\*(Aq, \& lazy => 1, \& builder => \*(Aq_build_size\*(Aq, \& clearer => \*(Aqclear_size\*(Aq, \& predicate => \*(Aqhas_size\*(Aq, \& ); .Ve .ie n .SS """associate_method(MethodName)""" .el .SS "\f(CWassociate_method(MethodName)\fP" .IX Subsection "associate_method(MethodName)" Associates a method with the attribute. Typically, this is called internally when an attribute generates its accessors. .PP Currently the argument \fIMethodName\fR is ignored in Mouse. .ie n .SS """verify_against_type_constraint(Item) \-> TRUE | ERROR""" .el .SS "\f(CWverify_against_type_constraint(Item) \-> TRUE | ERROR\fP" .IX Subsection "verify_against_type_constraint(Item) -> TRUE | ERROR" Checks that the given value passes this attribute's type constraint. Returns \f(CW\*(C`true\*(C'\fR on success, otherwise \f(CW\*(C`confess\*(C'\fRes. .ie n .SS """clone_and_inherit_options(options) \-> Mouse::Meta::Attribute""" .el .SS "\f(CWclone_and_inherit_options(options) \-> Mouse::Meta::Attribute\fP" .IX Subsection "clone_and_inherit_options(options) -> Mouse::Meta::Attribute" Creates a new attribute in the owner class, inheriting options from parent classes. Accessors and helper methods are installed. Some error checking is done. .ie n .SS """get_read_method_ref""" .el .SS "\f(CWget_read_method_ref\fP" .IX Subsection "get_read_method_ref" .ie n .SS """get_write_method_ref""" .el .SS "\f(CWget_write_method_ref\fP" .IX Subsection "get_write_method_ref" Returns the subroutine reference of a method suitable for reading or writing the attribute's value in the associated class. These methods always return a subroutine reference, regardless of whether or not the attribute is read\- or write-only. .SH "SEE ALSO" .IX Header "SEE ALSO" Moose::Meta::Attribute .PP Class::MOP::Attribute