Isolate OS dependencies
Andrew DeFaria <Andrew@ClearSCM.com>
Tue Jan 3 11:36:10 PST 2006
Modifed 2011/11/16 19:46:13
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 $ARCHITECTURE\n"; `$cmd > $NULL 2>&1`; my $filename = $app_base . $SEPARATOR . "datafile.txt";
This module exports several variables that are useful to isolate OS dependencies. For example, $ARCHITECTURE 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;
The following routines are exported:
Returns $TRUE if you are operating under a chrooted environment, $FALSE otherwise.
Set to either "windows", "cygwin" or $^O.
Set to "NUL" for Windows, "/dev/null" otherwise.
Set to "\" for Windows, "/" otherwise.
Convenient boolean variable set to 1 (Cause I always forget if 1 or 0 is true)
Convenient boolean variable set to 0 (Cause I always forget if 1 or 0 is false)
Set to SYSTEMDRIVE for Windows, "/" otherwise
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.