Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: How can I check from wich OS the script is running?

by Rex(Wrecks) (Curate)
on Jul 26, 2002 at 18:02 UTC ( [id://185619]=note: print w/replies, xml ) Need Help??


in reply to How can I check from wich OS the script is running?

The $^O that others have described will get you started, and for your *nix uses will be just fine. However it will only say "Win32" for any Windows OS. To require Win NT/2K/XP you can check for the value of $ENV{OS} and make sure it is "Windows_NT". It will be empty (non-existant) for the Win9x OS's. If you want more granularity than that for Windows, you need to start grubbing through the registry.

Note: I'm not sure how the Config solution above will work on something like ActiveState which is pretty much precompiled bins.

"Nothing is sure but death and taxes" I say combine the two and its death to all taxes!
  • Comment on Re: How can I check from wich OS the script is running?

Replies are listed 'Best First'.
Re: Re: How can I check from wich OS the script is running?
by myocom (Deacon) on Jul 26, 2002 at 18:26 UTC
    Note: I'm not sure how the Config solution above will work on something like ActiveState which is pretty much precompiled bins.

    I know: not well... That returns MSWin324.0, which is clearly not true for my platform (ActivePerl 5.6.1 on WinXP).

    "One word of warning: if you meet a bunch of Perl programmers on the bus or something, don't look them in the eye. They've been known to try to convert the young into Perl monks." - Frank Willison
      Looks to me like [MS]Win32/4.0 is the system that AS compiled the binaries on (since Config.pm is created during compile for the purpose of recording such information). Because Win32 binaries are compatible across Windows versions this means that relying on that is misleading.

      However, the shell command 'ver' on my machine emits "Microsoft Windows 2000 [Version 5.00.2195]", so if you need more granular information about which Windows version you are running on, you might try that.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-04-19 22:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found