From: Cory Watson Date: Thu, 21 Oct 2010 23:26:12 +0000 (-0500) Subject: Save some work, thanks Chip. X-Git-Tag: 0.07^0 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=81d4422f512edf1f1db7d9ddf733f2407b8e7bca;p=gitmo%2FMooseX-UndefTolerant.git Save some work, thanks Chip. --- diff --git a/Changes b/Changes index d3c3e21..87ed13c 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,8 @@ Revision history for MooseX-UndefTolerant +0.07 + * Don't do extra work by exists-ing before defined-ing (Chip Salzenberg) + 0.06 * Add support for immutable classes (Chris Andrews) * Be more careful avoiding warnings when the init_arg is undef (Chris Andrews) diff --git a/lib/MooseX/UndefTolerant.pm b/lib/MooseX/UndefTolerant.pm index 76cbb5e..0f3bec6 100644 --- a/lib/MooseX/UndefTolerant.pm +++ b/lib/MooseX/UndefTolerant.pm @@ -6,7 +6,7 @@ use Moose::Exporter; use MooseX::UndefTolerant::Attribute; use MooseX::UndefTolerant::Constructor; -our $VERSION = '0.06'; +our $VERSION = '0.07'; Moose::Exporter->setup_import_methods( class_metaroles => { diff --git a/lib/MooseX/UndefTolerant/Attribute.pm b/lib/MooseX/UndefTolerant/Attribute.pm index 970b70b..97ad7ea 100644 --- a/lib/MooseX/UndefTolerant/Attribute.pm +++ b/lib/MooseX/UndefTolerant/Attribute.pm @@ -9,7 +9,7 @@ around('initialize_instance_slot', sub { # $_[2] is the hashref of options passed to the constructor. If our # parameter passed in was undef, pop it off the args... - pop unless (defined $ia && exists($_[2]->{$ia}) && defined($_[2]->{$ia})); + pop unless (defined $ia && defined($_[2]->{$ia})); # Invoke the real init, as the above line cleared the unef $self->$orig(@_)