NAME
Template::OS - Operating System specific values
SYNOPSIS
use Template::OS;
$os = Template::OS->new(); # autodetect
$unix = Template::OS-new('unix'); # or 'mac', 'vms', 'win', 'os2'
$Template::OS::OS = 'win'; # define $OS to override autodetect
$win = Template::OS->new();
# member items
$os->{'id'}; # 'unix', 'mac', 'win', etc.
$os->{'name'}; # 'Unix', 'MacOS', 'Win32', etc.
$os->{'pathsep'}; # '/', ':', '\\', etc.
# OO interface
$os->id(); # as above...
$os->name()
$os->pathsep()
DESCRIPTION
The Template::OS module defines a few convenient operating-system specific values.
use OS;
The new() constructor is called to create a Template::OS object (hash) which contains this information. By default, the operating system will be automatically detected unless a specific O/S identifier is passed as a parameter. Operating system identifiers may be: 'unix', 'mac', 'win', 'vms' or 'os2'.
my $os = OS->new;
my $os = OS->new('win');
The object returned is a hash array blessed into the OS class. The following items are defined in this hash:
id => short identifier, e.g. 'unix', 'win', 'mac'
name => name: 'Unix,', 'Win32', 'MacOS'
pathsep => path (directory) separator e.g. '/', '\\', ':'
Items in the OS object may therefore be accessed directly.
print "Running on ", $os->{'name'}, "\n";
Public methods are also provided for accessing such members.
print "Running on ", $os->name(), "\n";
print "Running on ", $os->name, "\n";
AUTHOR
Andy Wardley <cre.canon.co.uk>
REVISION
$Revision: 1.1 $
COPYRIGHT
Copyright (C) 1996-1999 Andy Wardley. All Rights Reserved. Copyright (C) 1998-1999 Canon Research Centre Europe Ltd.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.