Cache::Memcached - pos() weirdness
Dave Evans
memcached-list-20040309@djce.org.uk
Sun, 18 Jul 2004 08:42:32 +0100
Brad Fitzpatrick wrote:
> This is still hanging around my inbox, but I feel dirty applying it
> without knowing the real problem. (which I suspect is Perl's fault)
Agreed on both counts.
> Dave: can you test this one-liner instead:
> From:> my $p = pos($buf{$sock});
> To: > my $p = pos($buf{$sock}) || length($&);
>
> That way it shouldn't slow down or otherwise affect anything except on
> broken taint systems.
Actually if you don't mind I shan't bother trying that change, because
it /would/ slow a lot of things down - see "$&" in "man perlvar":
The use of this variable anywhere in a program imposes a considerable
performance penalty on all regular expression matches.
My current favourite patch for the problem is here:
http://rudolf.org.uk/utils/Cache-Memcached-1.13-taint.patch
Feedback appreciated!
Thanks,
--
Dave
PGP key: http://rudolf.org.uk/pgpkey