[Catalyst] Re: trouble with LocationMatch

A. Pagaltzis pagaltzis at gmx.de
Mon Oct 30 13:27:55 GMT 2006


* Dave Howorth <dhoworth at mrc-lmb.cam.ac.uk> [2006-10-30 11:40]:
> Hironori Yoshida wrote:
> > -        $base_path = $location;
> > +        $self->apache->path_info =~ m/$location/msx;
> > +        $base_path = $&;    # I know this is the match-vars
> 
> Programming Perl, Third Edition
> 
> 24.2.1. Time Efficiency
> 
> Avoid $& and its two buddies, $` and $'. Any occurrence in your
> program causes all matches to save the searched string for
> possible future reference. (However, once you've blown it, it
> doesn't hurt to have more of them.)

Besides the trivial fact that it’s buggy because it doesn’t
`quotemeta` the `$location` before using it as a regex.

Sincerely,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>



More information about the Catalyst mailing list