MooseX...ribute(3pm)

πŸ“¦
version 0.21 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu questing

πŸ’– 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 πŸŽ€


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