• Home
  • Services
    • Consultancy
    • Custom Software Solutions
    • Systems Adminsitration
    • SCM
      • Clearcase
      • Multisite
      • Clearquest
      • Release Managment
      • CVS
    • Web Applications
    • Customers
  • Publications
    • Clearcase
      • Triggers
      • Open Source Builds
    • Clearquest
      • Clearquest Daemon
      • DB Conversions
    • Systems Admin
      • Unix/Linux
      • Windows
    • Scripting
      • Perl
      • PHP
      • ECRDig
  • About
    • Services
    • Our People
    • Our Philosophy
    • Contact Us
 

ClearSCM Inc.

You are viewing an unstyled version of this page. Either your browser does not support Cascading Style Sheets (CSS) or CSS styling has been disabled.

NAME OSDep.pm

Isolate OS dependencies

VERSION

Author

Andrew DeFaria <Andrew@ClearSCM.com>

Revision

Revision 1.7

Created

Tue Jan 3 11:36:10 PST 2006

Modified

Modifed 2008/02/29 15:08:56

SYNOPSIS

This module seeks to isolate OS dependences by confining them to this module as well as provide convienent references and mechanisms for doing things that are different on different OSes.

 print "Running on $arch\n";
 `$cmd > $null 2>&1`;
 my $filename = $app_base . $separator . "datafile.txt";

DESCRIPTION

This module exports several variables that are useful to isolate OS dependencies. For example, $arch is set to ``windows'', ``cygwin'' or the value of $^O depending on which OS the script is running. This allows you to write code that is dependant on which OS you are running on. Similarly, $null is set to the string ``NUL'' when running on Windows otherwise it is set to ``/dev/null'' (Under Cygwin /dev/null is appropriate). This way if you wish to say redirect output to ``null'' you can use $null.

There is currently only one subroutine exported, Chrooted, which returns $true if you are operating in a chrooted environment, $false otherwise;

ROUTINES

The following routines are exported:

Chrooted ()

Returns $true if you are operating under a chrooted environment, $false otherwise.

Parameters:

None

Returns:

Boolean

VARIABLES

$arch

Set to either ``windows'', ``cygwin'' or $^O.

$null

Set to ``NUL'' for Windows, ``/dev/null'' otherwise.

$separator

Set to ``\'' for Windows, ``/'' otherwise.

$true;

Convenient boolean variable set to 1 (Cause I always forget if 1 or 0 is true)

$false

Convenient boolean variable set to 0 (Cause I always forget if 1 or 0 is false)

$root

Set to SYSTEMDRIVE for Windows, ``/'' otherwise

DEPENDENCIES

None

INCOMPATABILITIES

None yet...

BUGS AND LIMITATIONS

There are no known bugs in this module.

Please report problems to Andrew DeFaria <Andrew@ClearSCM.com>.

LICENSE AND COPYRIGHT

This Perl Module is freely available; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This Perl Module is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License (http://www.gnu.org/copyleft/gpl.html) for more details.

You should have received a copy of the GNU General Public License along with this Perl Module; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. reserved.