in reply to How to cache a regular expression in a DBIx::Class object
Try something like
sub match_re { my $self = shift; # retrieve from cache if it's there: my $re = $self->{match_re}; return $re if defined $re; # otherwise compute it and store it: $re = $self->match_string; $re = qr/\Q$re\E/; return $self->{match_re} = $re; }
in the result class.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to cache a regular expression in a DBIx::Class object
by chrestomanci (Priest) on Apr 08, 2011 at 21:04 UTC | |
by moritz (Cardinal) on Apr 09, 2011 at 11:31 UTC |