line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Stream::Capabilities; |
2
|
109
|
|
|
109
|
|
1172
|
use strict; |
|
109
|
|
|
|
|
185
|
|
|
109
|
|
|
|
|
2590
|
|
3
|
109
|
|
|
109
|
|
502
|
use warnings; |
|
109
|
|
|
|
|
199
|
|
|
109
|
|
|
|
|
2406
|
|
4
|
|
|
|
|
|
|
|
5
|
109
|
|
|
109
|
|
491
|
use Config; |
|
109
|
|
|
|
|
189
|
|
|
109
|
|
|
|
|
4777
|
|
6
|
109
|
|
|
109
|
|
524
|
use Carp qw/croak/; |
|
109
|
|
|
|
|
178
|
|
|
109
|
|
|
|
|
15458
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub import { |
9
|
235
|
|
|
235
|
|
586
|
my $class = shift; |
10
|
235
|
|
|
|
|
482
|
my $caller = caller; |
11
|
|
|
|
|
|
|
|
12
|
235
|
|
|
|
|
610
|
for my $check (@_) { |
13
|
247
|
50
|
33
|
|
|
3507
|
croak "'$check' is not a known capability" |
14
|
|
|
|
|
|
|
unless $check =~ m/^CAN_/ && $class->can("$check"); |
15
|
|
|
|
|
|
|
|
16
|
247
|
|
|
|
|
670
|
my $const = get_const($check); |
17
|
109
|
|
|
109
|
|
580
|
no strict 'refs'; |
|
109
|
|
|
|
|
196
|
|
|
109
|
|
|
|
|
44384
|
|
18
|
247
|
|
|
|
|
368
|
*{"$caller\::$check"} = $const; |
|
247
|
|
|
|
|
11624
|
|
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my %LOOKUP; |
23
|
|
|
|
|
|
|
sub get_const { |
24
|
251
|
|
|
251
|
0
|
432
|
my $check = shift; |
25
|
|
|
|
|
|
|
|
26
|
251
|
100
|
|
|
|
894
|
unless ($LOOKUP{$check}) { |
27
|
228
|
|
|
|
|
706
|
my $bool = __PACKAGE__->$check; |
28
|
228
|
|
|
0
|
|
2290
|
$LOOKUP{$check} = sub() { $bool }; |
|
0
|
|
|
|
|
0
|
|
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
251
|
|
|
|
|
657
|
return $LOOKUP{$check}; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub CAN_REALLY_FORK { |
35
|
10
|
50
|
|
10
|
1
|
151
|
return 1 if $Config{d_fork}; |
36
|
0
|
|
|
|
|
0
|
return 0; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub CAN_FORK { |
40
|
109
|
50
|
|
109
|
1
|
7407
|
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
|
541
|
return 0 unless $] >= 5.008001; |
52
|
109
|
50
|
|
|
|
1159
|
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__ |