gugod/App-perlbrew — pull request #265 by felliott (2012-11-20 19:05:35+00:00)
Title: Escape envvars in regexes with \Q and \E (fixes test failure on OS X)

This patch fixes a test failure when installing App::perlbrew 0.58 on OS X 10.6. The test failure is in command-exec.t (see end of message) and occurs because $PERLBREW_HOME is set to a tmpdir with the string '+++' in the path name. When this string is used in a regex, perl dies complaining about nested quantifiers. The fix is to quote $PERLBREW_HOME when it's used in regexes. This occurs four times in perlbrew_env(). A similar but unlikely issue could occur with $home in path_with_tilde(), so I've changed that, too.

Please let me know if you'd like me to make adjustments to the patch and thank you for all of your hard work on this amazing module!

Cheers,
Fitz Elliott

t/command-exec.t .................... 1/?

# Failed test 'perlbrew exec perl -E "say 42" invokes all perls' by dying:
# Nested quantifiers in regex; marked by <-- HERE in m/^/var/folders/dr/dr7jbASTF1yPnL76bBF-tk+++ <-- HERE TI/-Tmp-/f29LHerltl/ at /Users/fge7z/code/cpan-modules/App-perlbrew/blib/lib/App/perlbrew.pm line 1240.

expected do_system to be called exactly 4 times, but it was called 0 times

# Failed test 'perlbrew exec --with perl-5.12.3 perl -E "say 42" invokes perl-5.12.3/bin/perl' by dying:
# Nested quantifiers in regex; marked by <-- HERE in m/^/var/folders/dr/dr7jbASTF1yPnL76bBF-tk+++ <-- HERE TI/-Tmp-/f29LHerltl/ at /Users/fge7z/code/cpan-modules/App-perlbrew/blib/lib/App/perlbrew.pm line 1240.

expected do_system to be called exactly once, but it was called 0 times
# Looks like you failed 2 tests of 2.
t/command-exec.t .................... Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/2 subtests