1Perl::OSType(3) User Contributed Perl Documentation Perl::OSType(3)
2
3
4
6 Perl::OSType - Map Perl operating system names to generic types
7
9 version 1.002
10
12 use Perl::OSType ':all';
13
14 $current_type = os_type();
15 $other_type = os_type('dragonfly'); # gives 'Unix'
16
18 Modules that provide OS-specific behaviors often need to know if the
19 current operating system matches a more generic type of operating
20 systems. For example, 'linux' is a type of 'Unix' operating system and
21 so is 'freebsd'.
22
23 This module provides a mapping between an operating system name as
24 given by $^O and a more generic type. The initial version is based on
25 the OS type mappings provided in Module::Build and ExtUtils::CBuilder.
26 (Thus, Microsoft operating systems are given the type 'Windows' rather
27 than 'Win32'.)
28
30 No functions are exported by default. The export tag ":all" will export
31 all functions listed below.
32
33 os_type()
34 $os_type = os_type();
35 $os_type = os_type('MSWin32');
36
37 Returns a single, generic OS type for a given operating system name.
38 With no arguments, returns the OS type for the current value of $^O.
39 If the operating system is not recognized, the function will return the
40 empty string.
41
42 is_os_type()
43 $is_windows = is_os_type('Windows');
44 $is_unix = is_os_type('Unix', 'dragonfly');
45
46 Given an OS type and OS name, returns true or false if the OS name is
47 of the given type. As with "os_type", it will use the current
48 operating system as a default if no OS name is provided.
49
51 ยท Devel::CheckOS
52
54 David Golden <dagolden@cpan.org>
55
57 This software is copyright (c) 2010 by David Golden.
58
59 This is free software; you can redistribute it and/or modify it under
60 the same terms as the Perl 5 programming language system itself.
61
62
63
64perl v5.12.2 2010-11-16 Perl::OSType(3)