line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Stream::Capabilities; |
2
|
109
|
|
|
109
|
|
653
|
use strict; |
|
109
|
|
|
|
|
108
|
|
|
109
|
|
|
|
|
2369
|
|
3
|
109
|
|
|
109
|
|
286
|
use warnings; |
|
109
|
|
|
|
|
104
|
|
|
109
|
|
|
|
|
2129
|
|
4
|
|
|
|
|
|
|
|
5
|
109
|
|
|
109
|
|
294
|
use Config qw/%Config/; |
|
109
|
|
|
|
|
117
|
|
|
109
|
|
|
|
|
3730
|
|
6
|
109
|
|
|
109
|
|
338
|
use Carp qw/croak/; |
|
109
|
|
|
|
|
117
|
|
|
109
|
|
|
|
|
11921
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub import { |
9
|
233
|
|
|
233
|
|
397
|
my $class = shift; |
10
|
233
|
|
|
|
|
329
|
my $caller = caller; |
11
|
|
|
|
|
|
|
|
12
|
233
|
|
|
|
|
441
|
for my $check (@_) { |
13
|
247
|
50
|
33
|
|
|
2806
|
croak "'$check' is not a known capability" |
14
|
|
|
|
|
|
|
unless $check =~ m/^CAN_/ && $class->can("$check"); |
15
|
|
|
|
|
|
|
|
16
|
247
|
|
|
|
|
445
|
my $const = get_const($check); |
17
|
109
|
|
|
109
|
|
433
|
no strict 'refs'; |
|
109
|
|
|
|
|
131
|
|
|
109
|
|
|
|
|
32636
|
|
18
|
247
|
|
|
|
|
239
|
*{"$caller\::$check"} = $const; |
|
247
|
|
|
|
|
8513
|
|
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my %LOOKUP; |
23
|
|
|
|
|
|
|
sub get_const { |
24
|
251
|
|
|
251
|
0
|
249
|
my $check = shift; |
25
|
|
|
|
|
|
|
|
26
|
251
|
100
|
|
|
|
588
|
unless ($LOOKUP{$check}) { |
27
|
228
|
|
|
|
|
449
|
my $bool = __PACKAGE__->$check; |
28
|
228
|
|
|
0
|
|
1824
|
$LOOKUP{$check} = sub() { $bool }; |
|
0
|
|
|
|
|
0
|
|
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
251
|
|
|
|
|
421
|
return $LOOKUP{$check}; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub CAN_REALLY_FORK { |
35
|
10
|
50
|
|
10
|
1
|
115
|
return 1 if $Config{d_fork}; |
36
|
0
|
|
|
|
|
0
|
return 0; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub CAN_FORK { |
40
|
109
|
50
|
|
109
|
1
|
6089
|
return 1 if $Config{d_fork}; |
41
|
0
|
0
|
0
|
|
|
0
|
return 0 unless $^O eq 'MSWin32' || $^O eq 'NetWare'; |
42
|
0
|
0
|
|
|
|
0
|
return 0 unless $Config{useithreads}; |
43
|
0
|
0
|
|
|
|
0
|
return 0 unless $Config{ccflags} =~ /-DPERL_IMPLICIT_SYS/; |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
0
|
my $thread_const = get_const('CAN_THREAD'); |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
0
|
return $thread_const->(); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub CAN_THREAD { |
51
|
109
|
50
|
|
109
|
1
|
395
|
return 0 unless $] >= 5.008001; |
52
|
109
|
50
|
|
|
|
906
|
return 0 unless $Config{'useithreads'}; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# Threads are broken on perl 5.10.0 built with gcc 4.8+ |
55
|
0
|
0
|
0
|
|
|
|
if ($] == 5.010000 && $Config{'ccname'} eq 'gcc' && $Config{'gccversion'}) { |
|
|
|
0
|
|
|
|
|
56
|
0
|
|
|
|
|
|
my @parts = split /\./, $Config{'gccversion'}; |
57
|
0
|
0
|
0
|
|
|
|
return 0 if $parts[0] >= 4 && $parts[1] >= 8; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# Change to a version check if this ever changes |
61
|
0
|
0
|
|
|
|
|
return 0 if $INC{'Devel/Cover.pm'}; |
62
|
0
|
|
|
|
|
|
return 1; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
__END__ |