perlquestion
stevieb
<p>Hey there my fellow esteemed Monks!</p>
<p>I've been having a long-running problem that I'm finally fed up enough with to ask for help.</p>
<p>In my test suite for [https://github.com/stevieb9/berrybrew|berrybrew], I perform a path substitution in a configuration file before the tests load. The specific command which is run out of a batch script looks like this:</p>
<c>
call perl -i.bak -ne "s/berrybrew(?!\\+test)/berrybrew\\test/; print" test/data/config.json
</c>
<p>Essentially, that's supposed to change the path <c>C:\berrybrew</c> to <c>C:\berrybrew\test</c>.</p>
<p>On some of my Windows 10 systems, it works just fine, and everything goes on its merry way. On other Win10 systems, the change results in a tab character being inserted, so the path looks like this: <c>C:\berrybrew[TAB]est</c>. If I insert four backslashes in the replacement (ie. <c>berrybrew\\\\test</c>, it works. However, after a <c>git push</c> then a <c>git pull</c> on the other systems that work with just the two backslashes, it breaks.</p>
<p>What can I do to provide myself some consistency across systems? Is there some unicode trick or something I can use? I've tried replacing the forward slashes in the substitution to single-quotes (eg: <c>s///;</c> to <c>s''';</c>) to no avail.</p>
<p>I'd really like to get this resolved so that the substitution works reliably across all systems.</p>
<p>Cheers,</p>
<p>-stevieb</p>