lantfred has asked for the wisdom of the Perl Monks concerning the following question:

Is there a way of telling which version of MSWIN32 is being used for a perl script?

The reason I ask is that I provide a default editor as part of my GUI (it can be changed via the option menu) and I have found that notepad is under a different direcory on Vista to W2K or XP. I can check to see if the file is in a number of places and return a message box if it is not where I think it should be....but was wondering if there was a quicker solution

I have had to do different things depending on whether the OS is linux or windows...I expect that...but not between variations of windows. I thought using $^0 would be enough but apparently not

I am using Perl 5.8 (because it comes with Tk)...just for info

p.s. As an habitual vi user, I keep hitting the escape button when I finish editing and lose everything :-(

p.p.s. Question is too general to provide example code

Replies are listed 'Best First'.
Re: Which MS Windows?
by BrowserUk (Patriarch) on Sep 25, 2010 at 23:48 UTC
    Is there a way of telling which version of MSWIN32 is being used for a perl script?

    See Win32::GetOSVersion() &| Win32::GetOSName(). It comes with AS Perl's. Not sure about other Win32 perl variants.

    I have found that notepad is under a different direcory on Vista to W2K or XP. I can check to see if the file is in a number of places

    Wherever it is located, it will be in the (standard) path, so why not just let the shell find it?

      Not sure about other Win32 perl variants

      Yes, it's part of all Windows perls.

      Cheers,
      Rob
Re: Which MS Windows?
by GrandFather (Saint) on Sep 25, 2010 at 23:49 UTC

    How are you using notepad? Simplistically `notepad`; is all you need.

    True laziness is hard work

      Thanks for the advice...I will check in the Win package...it is a problem related to Vista (and possibly W 7)

      Incidentally, "notepad" on its own does not work on Vista but it does under W2K and XP...hence the question.

        Incidentally, "notepad" on its own does not work on Vista

        It works for me under Vista?

        The executable is located (via the path):

        C:\test>which notepad.exe C:\Windows\system32\notepad.exe

        Which is the same place as it was in XP.