logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

MooseX::UndefTolerant::Attribute - Make your attribute(s) tolerant to undef initialization

Author

       Cory G Watson <gphat at cpan.org>

Description

       Applying this trait to your attribute makes its initialization tolerant of of undef.  If you specify the
       value of undef to any of the attributes they will not be initialized (or will be set to the default, if
       applicable).  Effectively behaving as if you had not provided a value at all.

Name

       MooseX::UndefTolerant::Attribute - Make your attribute(s) tolerant to undef initialization

Support

       Bugs may be submitted through the RT bug tracker
       <https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-UndefTolerant> (or
       bug-MooseX-UndefTolerant@rt.cpan.org <mailto:bug-MooseX-UndefTolerant@rt.cpan.org>).

       There is also a mailing list available for users of this distribution, at
       <http://lists.perl.org/list/moose.html>.

       There is also an irc channel available for users of this distribution, at "#moose" on "irc.perl.org"
       <irc://irc.perl.org/#moose>.

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!

Version

       version 0.21

See Also