Use ||= to conditionally initialize, otherwise just returns the regex.
sub match_re { my $self = shift; return $self->{match_re} ||= do { my $match_string = $self->match_string; qr/\Q$match_string\E/; }; }
In reply to Re: How to cache a regular expression in a DBIx::Class object
by wind
in thread How to cache a regular expression in a DBIx::Class object
by chrestomanci
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |