Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Avoid headaches from Strawberry Perl 5.10.0 and binary SVK

by xdg (Monsignor)
on Jan 09, 2008 at 13:07 UTC ( [id://661343]=perlmeditation: print w/replies, xml ) Need Help??

I've discovered that Strawberry Perl 5.10.0 and the binary package of SVK for Windows don't always play well together.

The binary was built with (and bundles) Strawberry Perl 5.8.8 Alpha 2. After installing the new Strawbery Perl 5.10.0, I found I had weird situations where running "perl" on the command line would run the SVK perl executable instead of the Strawberry Perl one. (Some form of command location caching, I assume -- the last location of perl.exe, perhaps?).

For me, the answer was renaming the perl.exe in C:\Program Files\SVK\bin to svkperl.exe and changing references to perl.exe in c:\Program Files\SVK\svk.bat to match. I also deleted the PATH manipulation in svk.bat.

I hope this helps anyone else using these tools on Windows save a few minutes of confusion and frustration.

(Sorry, I can't help with the many hours of confusion and frustration caused by Windows itself.)

-xdg

Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Replies are listed 'Best First'.
Re: Avoid headaches from Strawberry Perl 5.10.0 and binary SVK
by Corion (Patriarch) on Jan 09, 2008 at 14:18 UTC

    There is no "command location caching", but what might trip you up is that changes to the environment made by .cmd or .bat files persist after the batch file has finished running. So once svk.bat moves the location of its own perl.exe in front of the location of your perl.exe in $ENV{PATH}, you will get the "wrong" perl.exe.

    Similar things can happen in Unix as well if you're not careful with how you set up %ENV and where you modify it.

      Similar things can happen in Unix as well if you're not careful with how you set up %ENV and where you modify it.

      I don't think so. If you run a script on Unix and it mucks with ENV, then when it terminates, that doesn't affect your ENV. There is no global ENV in Unix, unlike Windows.


      My criteria for good software:
      1. Does it work?
      2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?

        This has nothing to do with the global environment variables. They are not being modified in any way here.

        Because .BAT files are interpreted by the shell (cmd.exe) itself, set commands modify it's own copy of the environment vars and as it persists after the .BAt file ends, so do the changes made to it. Within that command shell instance only.

        No other existing instances are affected. And no new instances will be affected, unless they are started as children of this instance, in which case they will inherit the modifications made to their parent. When this instance (and any children it started) ends, the modifications disappear.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

      Supposedly the .bat file resets the PATH afterwards -- but maybe it doesn't in some cases (non-zero exit?). Here's the original:

      @echo off set APR_ICONV_PATH=C:\Program Files\svk\iconv set OLDPATH=%PATH% set PATH=C:\Program Files\svk\bin;%PATH% if "%OS%" == "Windows_NT" goto WinNT "C:\Program Files\svk\bin\perl" "C:\Program Files\svk\bin\svk" %1 %2 % +3 %4 %5 %6 %7 %8 %9 goto endofperl :WinNT "C:\Program Files\svk\bin\perl" "C:\Program Files\svk\bin\svk" %* if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl if %errorlevel% == 9009 echo You do not have SVK installed correctly. if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul set PATH=%OLDPATH% set APR_ICONV_PATH=

      -xdg

      Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://661343]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (3)
As of 2024-04-20 13:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found