Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: Backward compatibility: $^O in perl 4

by krujos (Curate)
on May 07, 2003 at 16:42 UTC ( #256290=note: print w/replies, xml ) Need Help??

in reply to Backward compatibility: $^O in perl 4

Why not just use
$OS_TYPE=`uname -s` $OS_VERSION=`uname -r
Seems eaiser. Update: This way there are no special cases needed in the code.

Replies are listed 'Best First'.
Special case! [was: Re: Re: Backward compatibility: $^O in perl 4]
by bronto (Priest) on May 08, 2003 at 09:01 UTC

    Actually there is at least one special case: AIX. AIX does it its own way: uname -r returns the minor version of the OS, while uname -v returns the major version; this is the output on AIX 4.3:

    bash$ uname -s AIX bash$ uname -r 3 bash$ uname -v 4

    With your code the system will appear to have AIX 3 intead of 4...


    The very nature of Perl to be like natural language--inconsistant and full of dwim and special cases--makes it impossible to know it all without simply memorizing the documentation (which is not complete or totally correct anyway).
    --John M. Dlugosz
      Whoa. I have never caught that before, never had to worry about versions on AIX. Thanks, I will change my code accordingly. You Rock!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://256290]
[Lady_Aleena]: I"m getting: Not a SCALAR reference at ../files/lib/Base/ line 114. which is weird because it should be a string.

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (6)
As of 2017-04-27 12:41 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (506 votes). Check out past polls.