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.010
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 Bugs / Feature Requests
55 Please report any bugs or feature requests through the issue tracker at
56 <https://github.com/Perl-Toolchain-Gang/Perl-OSType/issues>. You will
57 be notified automatically of any progress on your issue.
58
59 Source Code
60 This is open source software. The code repository is available for
61 public review and contribution under the terms of the license.
62
63 <https://github.com/Perl-Toolchain-Gang/Perl-OSType>
64
65 git clone https://github.com/Perl-Toolchain-Gang/Perl-OSType.git
66
68 David Golden <dagolden@cpan.org>
69
71 • Chris 'BinGOs' Williams <chris@bingosnet.co.uk>
72
73 • David Golden <xdg@xdg.me>
74
75 • Graham Ollis <plicease@cpan.org>
76
77 • Jonas B. Nielsen <jonasbn@hoarfrost.local>
78
79 • Owain G. Ainsworth <oga@nicotinebsd.org>
80
81 • Paul Green <Paul.Green@stratus.com>
82
83 • Piotr Roszatycki <piotr.roszatycki@gmail.com>
84
86 This software is copyright (c) 2016 by David Golden.
87
88 This is free software; you can redistribute it and/or modify it under
89 the same terms as the Perl 5 programming language system itself.
90
91
92
93perl v5.36.0 2022-07-22 Perl::OSType(3)