.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" 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 .\" ======================================================================== .\" .IX Title "MooX::ShortHas 3pm" .TH MooX::ShortHas 3pm "2022-10-14" "perl v5.34.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" MooX::ShortHas \- shortcuts for common Moo has attribute configurations .SH "VERSION" .IX Header "VERSION" version 1.202040 .SH "SYNOPSIS" .IX Header "SYNOPSIS" Instead of: .PP .Vb 1 \& use Moo; \& \& has hro => is => ro => required => 1; \& has hlazy => is => lazy => builder => sub { 2 }; \& has hrwp => is => rwp => required => 1; \& has hrw => is => rw => required => 1; .Ve .PP You can now write: .PP .Vb 2 \& use Moo; \& use MooX::ShortHas; \& \& ro "hro"; \& lazy hlazy => sub { 2 }; \& rwp "hrwp"; \& rw "hrw"; .Ve .PP And options can be added or overridden by appending them: .PP .Vb 1 \& ro hro_opt => required => 0; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Moo's \f(CW\*(C`has\*(C'\fR asks developers to repeat themselves a lot to set up attributes, and since its inceptions the most common configurations of attributes have crystallized through long usage. .PP This module provides sugar shortcuts that wrap around has under the appropriate names to reduce the effort of setting up an attribute to naming it with a shortcut. .SH "EXPORTS" .IX Header "EXPORTS" .SS "ro, rwp, rw" .IX Subsection "ro, rwp, rw" These three work the same, they convert a call like this: .PP .Vb 1 \& ro $name => @extra_args; .Ve .PP To this corresponding has call: .PP .Vb 1 \& has $name => is => ro => required => 1 => @extra_args; .Ve .PP The appending of extra args makes it easy to override the required if necessary. .SS "lazy" .IX Subsection "lazy" This one is slightly different than the others, as lazy arguments don't require a constructor value, but almost always want a builder of some kind: .PP .Vb 1 \& lazy $name => @extra_args; .Ve .PP Corresponds to: .PP .Vb 1 \& has $name => is => lazy => builder => @extra_args; .Ve .PP The first extra argument is thus expected to be any of the values appropriate for the builder option. .SH "SEE ALSO" .IX Header "SEE ALSO" .IP "\(bu" 4 Mu \- automatically wraps this module into Moo .IP "\(bu" 4 Mu::Role \- automatically wraps this module into Moo::Role .IP "\(bu" 4 Mus \- Mu but with slightly more typing and strict constructors .SH "SUPPORT" .IX Header "SUPPORT" .SS "Bugs / Feature Requests" .IX Subsection "Bugs / Feature Requests" Please report any bugs or feature requests through the issue tracker at . You will be notified automatically of any progress on your issue. .SS "Source Code" .IX Subsection "Source Code" This is open source software. The code repository is available for public review and contribution under the terms of the license. .PP .PP .Vb 1 \& git clone https://github.com/wchristian/MooX\-ShortHas.git .Ve .SH "AUTHOR" .IX Header "AUTHOR" Christian Walde .SH "CONTRIBUTORS" .IX Header "CONTRIBUTORS" .IP "\(bu" 4 Graham Knop .IP "\(bu" 4 Zakariyya Mughal .IP "\(bu" 4 mst \- Matt S. Trout (cpan:MSTROUT) .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Christian Walde has dedicated the work to the Commons by waiving all of his or her rights to the work worldwide under copyright law and all related or neighboring legal rights he or she had in the work, to the extent allowable by law. .PP Works under \s-1CC0\s0 do not require attribution. When citing the work, you should not imply endorsement by the author.