$accessor .= 'return $self->{$key};
}';
- return eval $accessor;
+ my $sub = eval $accessor;
+ confess $@ if $@;
+ return $sub;
}
sub generate_predicate {
my $predicate = 'sub { exists($_[0]->{$key}) }';
- return eval $predicate;
+ my $sub = eval $predicate;
+ confess $@ if $@;
+ return $sub;
}
sub generate_clearer {
my $attribute = shift;
my $key = $attribute->name;
- my $predicate = 'sub { delete($_[0]->{$key}) }';
+ my $clearer = 'sub { delete($_[0]->{$key}) }';
- return eval $predicate;
+ my $sub = eval $clearer;
+ confess $@ if $@;
+ return $sub;
}
sub generate_handles {
}';
$method_map{$local_method} = eval $method;
+ confess $@ if $@;
}
return \%method_map;