Subject: | no string evals patch |
Hi,
is there a reason for string evals? Attached is a patch that replaces
them with "eval {};" and the tests are passing :-) non-string evals
should be a bit more faster.
Regards,
Jozef
Subject: | Class-Accessor-Grouped-0.08003_nostringeval.patch |
diff -Naur Class-Accessor-Grouped-0.08003/lib/Class/Accessor/Grouped.pm Class-Accessor-Grouped-0.08003_nostringeval/lib/Class/Accessor/Grouped.pm
--- Class-Accessor-Grouped-0.08003/lib/Class/Accessor/Grouped.pm 2009-03-21 14:27:28.000000000 +0100
+++ Class-Accessor-Grouped-0.08003_nostringeval/lib/Class/Accessor/Grouped.pm 2009-06-02 16:17:58.000000000 +0200
@@ -153,14 +153,14 @@
my $get = "get_$group";
# eval for faster fastiness
- return eval "sub {
- if(\@_ > 1) {
- return shift->$set('$field', \@_);
+ return eval { sub {
+ if(@_ > 1) {
+ return shift->$set($field, @_);
}
else {
- return shift->$get('$field');
+ return shift->$get($field);
}
- };"
+ }};
}
=head2 make_group_ro_accessor
@@ -183,16 +183,16 @@
my $get = "get_$group";
- return eval "sub {
- if(\@_ > 1) {
- my \$caller = caller;
- Carp::croak(\"'\$caller' cannot alter the value of '$field' on \".
- \"objects of class '$class'\");
+ return eval { sub {
+ if(@_ > 1) {
+ my $caller = caller;
+ Carp::croak("'$caller' cannot alter the value of '$field' on ".
+ "objects of class '$class'");
}
else {
- return shift->$get('$field');
+ return shift->$get($field);
}
- };"
+ }};
}
=head2 make_group_wo_accessor
@@ -215,16 +215,16 @@
my $set = "set_$group";
- return eval "sub {
- unless (\@_ > 1) {
- my \$caller = caller;
- Carp::croak(\"'\$caller' cannot access the value of '$field' on \".
- \"objects of class '$class'\");
+ return eval { sub {
+ unless (@_ > 1) {
+ my $caller = caller;
+ Carp::croak("'$caller' cannot access the value of '$field' on ".
+ "objects of class '$class'");
}
else {
- return shift->$set('$field', \@_);
+ return shift->$set($field, @_);
}
- };"
+ }};
}
=head2 get_simple