Skip Menu |

This queue is for tickets about the Class-Accessor-Grouped CPAN distribution.

Report information
The Basics
Id: 46621
Status: rejected
Priority: 0/
Queue: Class-Accessor-Grouped

People
Owner: claco [...] cpan.org
Requestors: jozef [...] kutej.net
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.08004
Fixed in: (no value)



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
Actually, this makes things slower due to when and how many times things are evaled.