- expand is => 'lazy' doc to make it clear that you can make rw lazy
attributes if you really want to
- handles => "RoleName" tries to load the module
+ - fix delegation to false/undef attributes (RT#83361)
1.000008 - 2013-02-06
- Re-export on 'use Moo' after 'no Moo'
}
if (my $asserter = $spec->{asserter}) {
$self->{captures} = {};
+
+ my $code = "do {\n"
+ ." my \$val = ".$self->_generate_get($name, $spec).";\n"
+ ." unless (".$self->_generate_simple_has('$_[0]', $name).") {\n"
+ .qq! die "Attempted to access '${name}' but it is not set";\n!
+ ." }\n"
+ ." \$val;\n"
+ ."}\n";
+
$methods{$asserter} =
- quote_sub "${into}::${asserter}" =>
- 'do { '.$self->_generate_get($name, $spec).qq! }||die "Attempted to access '${name}' but it is not set"!,
+ quote_sub "${into}::${asserter}" => $code,
delete $self->{captures}
;
}
package Baz;
use Moo;
sub beep {'beep'}
+
+ sub is_passed_undefined { !defined($_[0]) ? 'bar' : 'fail' }
}
{
eat_curry => [ yum => 'Curry!' ],
});
has foo5 => ( is => 'ro', handles => 'ExtRobot' );
+ has foo6 => ( is => 'rw',
+ handles => { foobot => '${\\Baz->can("beep")}'},
+ default => sub { 0 } );
+ has foo7 => ( is => 'rw',
+ handles => { foobar => '${\\Baz->can("is_passed_undefined")}'},
+ default => sub { undef } );
+
}
my $bar = Bar->new(
is $bar->eat_curry, 'Curry!', 'handles works for currying';
+is $bar->foobot, 'beep', 'asserter checks for existence not truth, on false value';
+
+is $bar->foobar, 'bar', 'asserter checks for existence not truth, on undef ';
done_testing;