Utils/OS_features.pm

filter: Statementstmt 73.0% 19 / 26 Branchbran 50.0% 7 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 67.4% 29 / 43 CC 1 SCAR 0.0
CC
1
Cov
65%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Pkt.pm ↑ Summary
1 package FTN::Utils::OS_features;
2 1 our $VERSION = "1.02";
3  
4 BEGIN
5 1 ▶{
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 require Exporter;
7 1 @ISA = qw(Exporter);
8 1 @EXPORT = qw($needs_binmode $dir_separator);
9 1 1;
10 }
11  
12 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 our($needs_binmode, $dir_separator);
16  
17 1 require Config;
18 1 my $OS = $Config::Config{'osname'};
19  
20 0 ▶if ($OS =~ /^MSWin/i) { $OS = 'WINDOWS'; }
Branch: 7 branches
BranchTrueFalseTotal
if ($OS =~ /^MSWin/i) { } 0 1 1
elsif ($OS =~ /^VMS/i) { } 0 1 1
elsif ($OS =~ /^dos/i) { } 0 1 1
elsif ($OS =~ /^MacOS/i) { } 0 1 1
elsif ($OS =~ /^os2/i) { } 0 1 1
elsif ($OS =~ /^epoc/i) { } 0 1 1
elsif ($OS =~ /^cygwin/i) { } 0 1 1
21 0 elsif ($OS =~ /^VMS/i) { $OS = 'VMS'; }
22 0 elsif ($OS =~ /^dos/i) { $OS = 'DOS'; }
23 0 elsif ($OS =~ /^MacOS/i) { $OS = 'MACINTOSH';}
24 0 elsif ($OS =~ /^os2/i) { $OS = 'OS2'; }
25 0 elsif ($OS =~ /^epoc/i) { $OS = 'EPOC'; }
26 0 elsif ($OS =~ /^cygwin/i){ $OS = 'CYGWIN'; }
27 1 else { $OS = 'UNIX'; }
28  
29 # Some OS logic. Binary mode enabled on DOS, NT and VMS
30 1 $needs_binmode = $OS=~/^(WINDOWS|DOS|OS2|CYGWIN)/;
31  
32  
33 # The path separator is a slash, backslash or semicolon, depending
34 # on the paltform.
35 $dir_separator = {
36 UNIX => '/', OS2 => '\\', EPOC => '/', CYGWIN => '/',
37 WINDOWS => '\\', DOS => '\\', MACINTOSH => ':', VMS => '/'
38 1 }->{$OS};
39  
40  
41 1 1;
42  
43  
44 =head1 NAME
45  
46 FTN::OS_features - an auxiliary module for FTN::Forum and FTN::Pkt
47  
48 =head1 DESCRIPTION
49  
50 This module detects some features of your Operating System. Two variables are exported.
51  
52 =over 8
53  
54 =item C<$needs_binmode>
55  
56 Boolean. I<True> if this OS differ binary and text files (e.g. Windows), I<false> otherwise (e.g. UNIX).
57  
58 =item C<$dir_separator>
59  
60 String. A char to separate directories in a path.
61  
62 =back
63  
64 =head1 CREDITS
65  
66 Thanks for Lincoln D. Stein, an author of CGI.pm
67  
68 =head1 COPYRIGHT
69  
70 Copyright 2008 Dmitry V. Kolvakh
71  
72 This library is free software.
73 You may copy or redistribute it under the same terms as Perl itself.
74  
75 =head1 AUTHOR
76  
77 Dmitry V. Kolvakh aka Keu
78  
79 2:5054/89@FIDOnet
80  
81 =cut
« Pkt.pm ↑ Summary