in reply to Re: how to recognize windows and linux os
in thread how to recognize windows and linux os

'perldoc perlvar'
$OSNAME $^O The name of the operating system under which this copy of Perl was built, as determined during the configuration process. The value is identical to $Config{'osname'}. See also Config and t +he -V command-line switch documented in perlrun.

Replies are listed 'Best First'.
Re^3: how to recognize windows and linux os
by glasswalk3r (Friar) on Jan 30, 2006 at 16:04 UTC
    Defining Your Needs

    If you know that your module simply will not run in a certain environment, you should set up prerequisites. These allow you to provide a level of safety for your users. Prerequisites include:

    OSes that your module will not run under

    Check $^O and %Config for this. $^O will tell you the name of the operating system. Sometimes, this isn't specific enough, so you can check %Config.

    use Config; if ( $Config{ osname } ne 'solaris' || $Config{ osver } < 2.9 ) { die "This module needs Solaris 2.9 or higher to run.\n"; }

    Source: http://www.perl.com/lpt/a/2005/04/14/cpan_guidelines.html

    Alceu Rodrigues de Freitas Junior
    ---------------------------------
    "You have enemies? Good. That means you've stood up for something, sometime in your life." - Sir Winston Churchill

    jdporter fixed markup