Mo::required(3)
β¨ NAME β¨
Mo::required β okay bestie, this is the little Mo plugin that adds the required feature to Mo's has π
it's in section 3 of the User Contributed Perl Documentation, so it's a Perl module manpage, and it is so tiny and so powerful. π«Ά
πΈ SYNOPSIS πΈ
Like, here's literally all the setup you need:
use Mo qw'required';
has name => ( required => 1 );
That's it. That's the whole vibe. π
π¦ DESCRIPTION π¦
So what does it do?? It adds the required parameter to has. π
And when required is set to a positive value, the constructor will die if the attribute is not set. π No cap, it just refuses. Attribute missing? Boom, constructor's gone, it's giving dramatic exit and honestly? deserved.
β οΈ Heads up bestie: positive value on required means the constructor dies when the attribute isn't set. That's not a warning, that's not a gentle nudge, that's a full-on death. πͺ¦
That's the whole page, iykyk. π This gorgeous lil slice of documentation is from perl v5.42.0, dated 2025-07-25 β shoutout to whoever wrote it, iconic behaviour fr fr. π β¨ π π¦ πΈ π π«Ά
π¦ where this page comes from
- fedora 43: perl-Mo 0.40-28.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms