MooX::ShortHas(3pm)
π MooX::ShortHas π
okay bestie, so this is the manual page for MooX::ShortHas (that's the (3pm) one, a Perl module, living in the User Contributed Perl Documentation section of your friendly neighborhood man pages). no cap, it's gonna save you SO much typing.
β¨ NAME β¨
MooX::ShortHas β shortcuts for common Moo has attribute configurations. it's giving "why am i typing is => ro => required => 1 for the hundredth time" and honestly? valid. π
π VERSION π
version 1.202040
πΈ SYNOPSIS πΈ
so instead of doing all this:
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;
you can now write this:
use Moo;
use MooX::ShortHas;
ro "hro";
lazy hlazy => sub { 2 };
rwp "hrwp";
rw "hrw";
like. look at it. it's so short. it's so clean. it's iconic, fr fr. π
and bestie, options can be added or overridden by appending them:
ro hro_opt => required => 0;
π¦ DESCRIPTION π¦
Moo's has makes devs repeat themselves a lot just to set up attributes β and since its inception, the most common attribute configurations have crystallized through long usage. the people have spoken. the patterns have emerged.
so this module provides sugar shortcuts that wrap around has under the appropriate names, so you can go from effortfully setting up an attribute to just... naming it with a shortcut. main character energy only. β¨
π EXPORTS π
π ro, rwp, rw
these three all work the same, okay? they convert a call like this:
ro $name => @extra_args;
to this corresponding has call:
has $name => is => ro => required => 1 => @extra_args;
the appending of extra args makes it easy to override the required if necessary. so it's flexible. we love flexibility. π
π§ lazy
okay this one is slightly different than the others, because lazy arguments don't require a constructor value, but they almost always want a builder of some kind:
lazy $name => @extra_args;
corresponds to:
has $name => is => lazy => builder => @extra_args;
so the first extra argument is thus expected to be any of the values appropriate for the builder option. iykyk. π«Ά
β SEE ALSO β
- Mu β automatically wraps this module into Moo
- Mu::Role β automatically wraps this module into Moo::Role
- Mus β Mu but with slightly more typing and strict constructors
π SUPPORT π
π Bugs / Feature Requests
please report any bugs or feature requests through the issue tracker at <https://github.com/wchristian/MooX-ShortHas/issues>. you will be notified automatically of any progress on your issue. we will keep you posted bestie, pinky promise. π
π¦ Source Code
this is open source software. the code repository is available for public review and contribution under the terms of the license.
<https://github.com/wchristian/MooX-ShortHas>
git clone https://github.com/wchristian/MooX-ShortHas.git
π AUTHOR π
Christian Walde <walde.christian@gmail.com>
π CONTRIBUTORS π
- Graham Knop <haarg@haarg.org>
- Zakariyya Mughal <zaki.mughal@gmail.com>
- mst - Matt S. Trout (cpan:MSTROUT) <mst@shadowcat.co.uk>
π 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.
Works under CC0 do not require attribution. When citing the work, you should not imply endorsement by the author.
okay that's the whole page bestie, every last flag and note, go forth and has no more π
β¨
and a lil cute sign-off for you: this was MooX::ShortHas(3pm), perl version v5.36.0, dated 2022-10-14. mwah. ππ¦
π¦ where this page comes from
- ubuntu noble: libmoox-shorthas-perl 1.202040-2 Β· CC0-1.0
- ubuntu resolute: libmoox-shorthas-perl 1.202040-2 Β· CC0-1.0
- ubuntu stonking: libmoox-shorthas-perl 1.202040-2 Β· CC0-1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms