| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Function::Fallback::CoreOrPP; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
437
|
use 5.010001; |
|
|
1
|
|
|
|
|
1
|
|
|
4
|
1
|
|
|
1
|
|
3
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
13
|
|
|
5
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
399
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.08'; # VERSION |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $USE_NONCORE_XS_FIRST = 1; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
require Exporter; |
|
12
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
|
13
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
|
14
|
|
|
|
|
|
|
clone |
|
15
|
|
|
|
|
|
|
clone_list |
|
16
|
|
|
|
|
|
|
unbless |
|
17
|
|
|
|
|
|
|
uniq |
|
18
|
|
|
|
|
|
|
); |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub clone { |
|
21
|
0
|
|
|
0
|
1
|
0
|
my $data = shift; |
|
22
|
0
|
0
|
|
|
|
0
|
goto FALLBACK unless $USE_NONCORE_XS_FIRST; |
|
23
|
0
|
0
|
|
|
|
0
|
goto FALLBACK unless eval { require Data::Clone; 1 }; |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
24
|
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
0
|
STANDARD: |
|
26
|
|
|
|
|
|
|
return Data::Clone::clone($data); |
|
27
|
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
0
|
FALLBACK: |
|
29
|
|
|
|
|
|
|
require Clone::PP; |
|
30
|
0
|
|
|
|
|
0
|
return Clone::PP::clone($data); |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub clone_list { |
|
34
|
0
|
|
|
0
|
1
|
0
|
map { clone($_) } @_; |
|
|
0
|
|
|
|
|
0
|
|
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub _unbless_fallback { |
|
38
|
4
|
|
|
4
|
|
3
|
my $ref = shift; |
|
39
|
|
|
|
|
|
|
|
|
40
|
4
|
|
|
|
|
5
|
my $r = ref($ref); |
|
41
|
|
|
|
|
|
|
# not a reference |
|
42
|
4
|
50
|
|
|
|
7
|
return $ref unless $r; |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# return if not a blessed ref |
|
45
|
4
|
50
|
|
|
|
28
|
my ($r2, $r3) = "$ref" =~ /(.+)=(.+?)\(/ |
|
46
|
|
|
|
|
|
|
or return $ref; |
|
47
|
|
|
|
|
|
|
|
|
48
|
4
|
100
|
|
|
|
13
|
if ($r3 eq 'HASH') { |
|
|
|
100
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
49
|
1
|
|
|
|
|
7
|
return { %$ref }; |
|
50
|
|
|
|
|
|
|
} elsif ($r3 eq 'ARRAY') { |
|
51
|
1
|
|
|
|
|
4
|
return [ @$ref ]; |
|
52
|
|
|
|
|
|
|
} elsif ($r3 eq 'SCALAR') { |
|
53
|
1
|
|
|
|
|
2
|
return \( my $copy = ${$ref} ); |
|
|
1
|
|
|
|
|
4
|
|
|
54
|
|
|
|
|
|
|
} elsif ($r3 eq 'CODE') { |
|
55
|
1
|
|
|
1
|
|
4
|
return sub { goto &$ref }; |
|
|
1
|
|
|
|
|
4
|
|
|
56
|
|
|
|
|
|
|
} else { |
|
57
|
0
|
|
|
|
|
0
|
die "Can't handle $ref"; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub unbless { |
|
62
|
4
|
|
|
4
|
1
|
507
|
my $ref = shift; |
|
63
|
|
|
|
|
|
|
|
|
64
|
4
|
50
|
|
|
|
14
|
goto FALLBACK unless $USE_NONCORE_XS_FIRST; |
|
65
|
0
|
0
|
|
|
|
0
|
goto FALLBACK unless eval { require Acme::Damn; 1 }; |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
66
|
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
0
|
STANDARD: |
|
68
|
|
|
|
|
|
|
return Acme::Damn::damn($ref); |
|
69
|
|
|
|
|
|
|
|
|
70
|
4
|
|
|
|
|
8
|
FALLBACK: |
|
71
|
|
|
|
|
|
|
return _unbless_fallback($ref); |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub uniq { |
|
75
|
1
|
50
|
|
1
|
1
|
937
|
goto FALLBACK unless $USE_NONCORE_XS_FIRST; |
|
76
|
0
|
0
|
|
|
|
0
|
goto FALLBACK unless eval { require List::MoreUtils; 1 }; |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
77
|
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
0
|
STANDARD: |
|
79
|
|
|
|
|
|
|
return List::MoreUtils::uniq(@_); |
|
80
|
|
|
|
|
|
|
|
|
81
|
1
|
|
|
|
|
2
|
FALLBACK: |
|
82
|
|
|
|
|
|
|
my %h; |
|
83
|
1
|
|
|
|
|
1
|
my @res; |
|
84
|
1
|
|
|
|
|
2
|
for (@_) { |
|
85
|
6
|
100
|
|
|
|
15
|
push @res, $_ unless $h{$_}++; |
|
86
|
|
|
|
|
|
|
} |
|
87
|
1
|
|
|
|
|
5
|
return @res; |
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
1; |
|
91
|
|
|
|
|
|
|
# ABSTRACT: Functions that use non-core XS module but provide pure-Perl/core fallback |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
__END__ |