| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package FTN::Utils::OS_features; |
|
2
|
|
|
|
|
|
|
our $VERSION = "1.02"; |
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
BEGIN |
|
5
|
|
|
|
|
|
|
{ |
|
6
|
1
|
|
|
1
|
|
8
|
require Exporter; |
|
7
|
1
|
|
|
|
|
20
|
@ISA = qw(Exporter); |
|
8
|
1
|
|
|
|
|
3
|
@EXPORT = qw($needs_binmode $dir_separator); |
|
9
|
1
|
|
|
|
|
25
|
1; |
|
10
|
|
|
|
|
|
|
} |
|
11
|
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
6
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
28
|
|
|
13
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
504
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our($needs_binmode, $dir_separator); |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
require Config; |
|
18
|
|
|
|
|
|
|
my $OS = $Config::Config{'osname'}; |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
if ($OS =~ /^MSWin/i) { $OS = 'WINDOWS'; } |
|
21
|
|
|
|
|
|
|
elsif ($OS =~ /^VMS/i) { $OS = 'VMS'; } |
|
22
|
|
|
|
|
|
|
elsif ($OS =~ /^dos/i) { $OS = 'DOS'; } |
|
23
|
|
|
|
|
|
|
elsif ($OS =~ /^MacOS/i) { $OS = 'MACINTOSH';} |
|
24
|
|
|
|
|
|
|
elsif ($OS =~ /^os2/i) { $OS = 'OS2'; } |
|
25
|
|
|
|
|
|
|
elsif ($OS =~ /^epoc/i) { $OS = 'EPOC'; } |
|
26
|
|
|
|
|
|
|
elsif ($OS =~ /^cygwin/i){ $OS = 'CYGWIN'; } |
|
27
|
|
|
|
|
|
|
else { $OS = 'UNIX'; } |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# Some OS logic. Binary mode enabled on DOS, NT and VMS |
|
30
|
|
|
|
|
|
|
$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
|
|
|
|
|
|
|
}->{$OS}; |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
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 if this OS differ binary and text files (e.g. Windows), I 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 |