On 3/7/07, demerphq <demerphq@gmail.com> wrote: > The change required to lib/ExtUtils/Liblist/Kid.pm fixes a bug in it > that was detected by the require_tie_mod() failures, but was not > actually related to it. The cause was that m-[\w$\-]- matches the same > as /[\w$-]/ and not /[\w$\-]/ as I guess the author expected. - if (($locspec,$type) = $lib =~ m-^([\w$\-]+)(/\w+)?- and $locspec =~ /perl/i) { + if (($locspec,$type) = $lib =~ m!^([\w$\-]+)(/\w+)?! and $locspec =~ /perl/i) { The code you changed in _vms_ext() has been as it was for many years (like 9, 10, maybe more) and has never caused any trouble I'm aware of, though I agree it does not seem to do what it was intended to. After your change it now always generates the following warning: Use of uninitialized value $\ in regexp compilation at ../../../../lib/ExtUtils/Liblist/Kid.pm line 392. easily reproducible like so since $\ is undef by default: $ perl -we "print $1 if 'foo$bar-baz' =~ m!([\w$\-]+)!;" Use of uninitialized value $\ in regexp compilation at -e line 1. foo Replacing "-" with "!" as the match delimiter changed the interpretation of C<$\-> so that the backslash no longer escapes the minus sign but now sidles up to the dollar sign to function as the special variable C<$\>. Whereas before we were inadvertently getting the special variable C<$-> interpolated, we are now inadvertently getting the special variable C<$\> interpolated. The default value of C<$-> is zero, so there was no uninitialized value warning the old way, but C<$\> defaults to undef and causes the warning. You can confirm all this by running one-liners under -Dr and seeing what regex you're really getting. I'm pretty sure the original intention for the character class was to match word characters, dollar signs and minus signs, not word characters, a special variable, and minus signs. The clue is that dollar signs appear quite frequently in system-supplied library names on VMS, and that is what this bit of code is working with. I think all we need is to escape the dollar sign and use a match delimiter that doesn't appear in the regex: $ perl -we "print qq/$1,$2\n/ if 'foo$bar-baz/share' =~ m|^([\w\$-]+)(/\w+)?|;" foo$bar-baz,/share I will test this in Kid.pm and see what else breaks as a result of fixing it :-(.Thread Previous | Thread Next