--- /dev/null
+Revision history for MooseX-Attribute-UndefTolerant
+
+0.01 Date/time
+ First version, released on an unsuspecting world.
+
--- /dev/null
+Changes
+MANIFEST
+Makefile.PL
+README
+lib/MooseX/Attribute/UndefTolerant.pm
+t/00-load.t
+t/pod-coverage.t
+t/pod.t
--- /dev/null
+use inc::Module::Install;
+
+name 'MooseX-Attribute-UndefTolerant';
+all_from 'lib/MooseX/Attribute/UndefTolerant.pm';
+author q{Cory G Watson <gphat@cpan.org>};
+license 'perl';
+
+build_requires 'Test::More';
+
+requires 'Moose';
+
+WriteAll;
--- /dev/null
+MooseX-Attribute-UndefTolerant
+
+The README is used to introduce the module and provide instructions on
+how to install the module, any machine dependencies it may have (for
+example C compilers and installed libraries) and any other information
+that should be provided before the module is installed.
+
+A README file is required for CPAN modules since CPAN extracts the README
+file from a module distribution so that people browsing the archive
+can use it to get an idea of the module's uses. It is usually a good idea
+to provide version information here so that people can decide whether
+fixes for the module are worth downloading.
+
+
+INSTALLATION
+
+To install this module, run the following commands:
+
+ perl Makefile.PL
+ make
+ make test
+ make install
+
+SUPPORT AND DOCUMENTATION
+
+After installing, you can find documentation for this module with the
+perldoc command.
+
+ perldoc MooseX::Attribute::UndefTolerant
+
+You can also look for information at:
+
+ RT, CPAN's request tracker
+ http://rt.cpan.org/NoAuth/Bugs.html?Dist=MooseX-Attribute-UndefTolerant
+
+ AnnoCPAN, Annotated CPAN documentation
+ http://annocpan.org/dist/MooseX-Attribute-UndefTolerant
+
+ CPAN Ratings
+ http://cpanratings.perl.org/d/MooseX-Attribute-UndefTolerant
+
+ Search CPAN
+ http://search.cpan.org/dist/MooseX-Attribute-UndefTolerant/
+
+
+COPYRIGHT AND LICENCE
+
+Copyright (C) 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.
+
--- /dev/null
+blib*
+Makefile
+Makefile.old
+Build
+_build*
+pm_to_blib*
+*.tar.gz
+.lwpcookies
+MooseX-Attribute-UndefTolerant-*
+cover_db
--- /dev/null
+package MooseX::UndefTolerant;
+use strict;
+use warnings;
+
+use Moose qw();
+use Moose::Exporter;
+use Moose::Util::MetaRole;
+
+use MooseX::UndefTolerant::Attribute;
+
+our $VERSION = '0.01';
+
+Moose::Exporter->setup_import_methods();
+
+sub init_meta {
+ my (undef, %options) = @_;
+
+ Moose->init_meta(%options);
+
+ return Moose::Util::MetaRole::apply_metaclass_roles(
+ for_class => $options{for_class},
+ attribute_metaclass_roles => [ 'MooseX::UndefTolerant::Attribute' ]
+ );
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+MooseX::Attribute::UndefTolerant - The great new MooseX::Attribute::UndefTolerant!
+
+=head1 SYNOPSIS
+
+ use MooseX::Attribute::UndefTolerant;
+
+
+=head1 AUTHOR
+
+Cory G Watson, C<< <gphat at cpan.org> >>
+
+=head1 ACKNOWLEDGEMENTS
+
+Hans Dieter Pearcey (confound)
+
+Jesse Luehrs (doy)
+
+Tomas Doran (t0m)
+
+Dylan Hardison (dylan)
+
+Jay Shirley (jshirley)
+
+Mike Eldridge (diz)
+
+=head1 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.
+
+
+=cut
--- /dev/null
+package MooseX::UndefTolerant::Attribute;
+use Moose::Role;
+
+around('initialize_instance_slot', sub{
+ my $orig = shift;
+ my $self = shift;
+
+ # If the parameter passed in was undef, quietly do nothing but return
+ return unless defined($_->[2]);
+
+ # If it was defined, call the real init slot method
+ $self->$orig(@_)
+});
+
+1;
\ No newline at end of file
--- /dev/null
+#!perl -T
+
+use Test::More tests => 1;
+
+BEGIN {
+ use_ok( 'MooseX::Attribute::UndefTolerant' );
+}
+
+diag( "Testing MooseX::Attribute::UndefTolerant $MooseX::Attribute::UndefTolerant::VERSION, Perl $], $^X" );
--- /dev/null
+use Test::More;
+
+package Foo;
+use Moose;
+
+has 'bar' => (
+ traits => [ qw(MooseX::UndefTolerant::Attribute)],
+ is => 'ro',
+ isa => 'Num',
+ predicate => 'has_bar'
+);
+
+package Foo2;
+use Moose;
+use MooseX::UndefTolerant;
+
+has 'bar' => (
+ is => 'ro',
+ isa => 'Num',
+ predicate => 'has_bar'
+);
+
+package main;
+
+{
+ my $foo = Foo->new;
+ ok(!$foo->has_bar);
+}
+
+{
+ my $foo = Foo->new(bar => undef);
+ ok(!$foo->has_bar);
+}
+
+{
+ my $foo = Foo2->new(bar => undef);
+ ok(!$foo->has_bar);
+}
+
+
+done_testing;
\ No newline at end of file