MooseX...ribute(3pm)
π NAME π
MooseX::UndefTolerant::Attribute β bestie, this trait makes your attribute(s) totally chill about being initialized with undef. No drama, no explosion. π«Ά
β¨ VERSION β¨
version 0.21 π
π SYNOPSIS π
package My:Class;
use Moose;
use MooseX::UndefTolerant::Attribute;
has 'bar' => (
traits => [ qw(MooseX::UndefTolerant::Attribute)],
is => 'ro',
isa => 'Num',
predicate => 'has_bar'
);
# Meanwhile, under the city...
# Doesn't explode
my $class = My::Class->new(bar => undef);
$class->has_bar # False!
okay so like. look at that. bar => undef goes in, and nothing screams. has_bar comes back False. it's giving peace. π¦
πΈ DESCRIPTION πΈ
So here's the tea: when you slap this trait onto your attribute, its initialization becomes tolerant of undef. If you hand any of those attributes the value undef, they justβ¦ don't get initialized. Not even a little. (Or they get set to the default instead, if there is one β so cute of them.)
Basically it acts exactly like you never gave a value at all. lowkey iconic behavior tbh. π
π«Ά SUPPORT π«Ά
Found a bug? Bestie, say something!! Bugs can be submitted through the RT bug tracker at <https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-UndefTolerant> β or you can email bug-MooseX-UndefTolerant@rt.cpan.org (that's <mailto:bug-MooseX-UndefTolerant@rt.cpan.org> if you need the mailto link π).
There's also a mailing list for users of this distribution, hanging out at <http://lists.perl.org/list/moose.html>. π
And there's an irc channel for users of this distribution too β it's #moose on irc.perl.org, i.e. <irc://irc.perl.org/#moose>. come say hi, iykyk β¨
π AUTHOR π
Cory G Watson <gphat at cpan.org> β periodt, thank you for your service π
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2011 by Cory G Watson.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
and that's a wrap, bestie!! this whole thing is perl v5.36.0, dated 2022-12-12, and it lives in your friendly neighborhood MooseX::UndefTolerant::Attribute(3pm) page. go forth and undef-tolerate responsibly ππΈπ¦
π¦ where this page comes from
- debian bookworm: libmoosex-undeftolerant-perl 0.21-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libmoosex-undeftolerant-perl 0.21-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libmoosex-undeftolerant-perl 0.21-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu questing: libmoosex-undeftolerant-perl 0.21-2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms