in reply to How to cache a regular expression in a DBIx::Class object
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/; }; }
|
|---|