my $get = "get_$group";
# eval for faster fastiness
- return eval "sub {
+ my $code = eval "sub {
if(\@_ > 1) {
return shift->$set('$field', \@_);
}
else {
return shift->$get('$field');
}
- };"
+ };";
+ Carp::croak $@ if $@;
+
+ return $code;
}
=head2 make_group_ro_accessor
my $get = "get_$group";
- return eval "sub {
+ my $code = eval "sub {
if(\@_ > 1) {
my \$caller = caller;
Carp::croak(\"'\$caller' cannot alter the value of '$field' on \".
else {
return shift->$get('$field');
}
- };"
+ };";
+ Carp::croak $@ if $@;
+
+ return $code;
}
=head2 make_group_wo_accessor
my $set = "set_$group";
- return eval "sub {
+ my $code = eval "sub {
unless (\@_ > 1) {
my \$caller = caller;
Carp::croak(\"'\$caller' cannot access the value of '$field' on \".
else {
return shift->$set('$field', \@_);
}
- };"
+ };";
+ Carp::croak $@ if $@;
+
+ return $code;
}
=head2 get_simple