[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]
Re: [perl #35877] \n after $ in regex (was: Strange regexfailure?)
Quoting David Nicol <davidnicol@gmail.com>:
> On Sun, May 25, 2008 at 8:24 AM, Zefram <zefram@fysh.org> wrote:
>
>> The latter is expected: $\ gets interpolated.
>
>
> Warn that non-final $ will interpolate in documentation and suggest
> \Z instead?
>
Given how easy it is to miss it I feel more for a
'Possible unintended interpolation of $\ in regex' warning. (if that
is even possible of course)
It will, obviously, result in false posistives in some regexes...
(although I can't remember ever using $\ in a re)
Doing a grep on perl-current seems to get only this as relevant lines:
(assuming I didn't remove too much, started with: grep -r '[^\\]\$\\'
* and then removing irrelevant lines)
ext/Compress/Raw/Zlib/private/MakeUtil.pm: exit 1 if
/^\s*local\s*\(\s*\$$\^W\s*\)/; \
ext/Compress/Zlib/private/MakeUtil.pm: exit 1 if
/^\s*local\s*\(\s*\$$\^W\s*\)/; \
ext/IO_Compress_Base/private/MakeUtil.pm: exit 1 if
/^\s*local\s*\(\s*\$$\^W\s*\)/; \
ext/IO_Compress_Zlib/private/MakeUtil.pm: exit 1 if
/^\s*local\s*\(\s*\$$\^W\s*\)/; \
Looking at the one in Compress::Zlib::private::MakeUtil:
my $postamble = '
MyTrebleCheck:
@echo Checking for $$^W in files: '. "@files" . '
@perl -ne \' \
exit 1 if /^\s*local\s*\(\s*\$$\^W\s*\)/; \
\' ' . " @files || " . ' \
(echo found unexpected $$^W ; exit 1)
@echo All is ok.
';
(Which leaves me wondering if it is intended or not)
Any comments on the warning?
Kind regards,
Bram
- Follow-Ups from:
-
"Yitzchak Scott-Thoennes" <sthoenna@efn.org>
[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]