View on
MetaCPAN
search.cpan.org is shutting down
For details read Perl NOC. After June 25th this page will redirect to MetaCPAN.org
Cory G Watson > MooseX-UndefTolerant-0.06 > MooseX::UndefTolerant::Attribute

Download:
MooseX-UndefTolerant-0.06.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Stalled  1
View/Report Bugs
Source   Latest Release: MooseX-UndefTolerant-0.21

NAME ^

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

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!

DESCRIPTION ^

Applying this trait to your attribute makes it's 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.

AUTHOR ^

Cory G Watson, <gphat at cpan.org>

COPYRIGHT & LICENSE ^

Copyright 2009 Cory G Watson.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

syntax highlighting: