line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Syntax::Feature::ValuesOnArray; # so as not to confuse dzil? |
2
|
|
|
|
|
|
|
our $VERSION = '0.04'; # VERSION |
3
|
1
|
|
|
1
|
|
363782
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
42
|
|
4
|
1
|
|
|
1
|
|
64
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
38
|
|
5
|
1
|
|
|
1
|
|
582
|
use Syntax::Feature::EachOnArray (); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
23
|
|
6
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
62
|
|
7
|
1
|
|
|
1
|
|
5
|
use Scalar::Util qw(reftype); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
177
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
package Tie::ArrayAsHash; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub avalues (\[@%]) { |
12
|
0
|
|
|
0
|
0
|
0
|
my $thing = shift; |
13
|
0
|
0
|
|
|
|
0
|
return values %$thing |
14
|
|
|
|
|
|
|
if reftype $thing eq 'HASH'; |
15
|
0
|
0
|
|
|
|
0
|
confess "should be passed a HASH or ARRAY" |
16
|
|
|
|
|
|
|
unless reftype $thing eq 'ARRAY'; |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
0
|
|
|
0
|
my $thing_h = $Tie::ArrayAsHash::cache{$thing} ||= do { |
19
|
0
|
|
|
|
|
0
|
tie my %h, __PACKAGE__, $thing; |
20
|
0
|
|
|
|
|
0
|
\%h |
21
|
|
|
|
|
|
|
}; |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
0
|
values %$thing_h; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
package Syntax::Feature::ValuesOnArray; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub install { |
29
|
1
|
|
|
1
|
0
|
10
|
my $class = shift; |
30
|
1
|
|
|
|
|
5
|
my %args = @_; |
31
|
|
|
|
|
|
|
|
32
|
1
|
50
|
|
|
|
24
|
return unless $^V lt 5.12.0; |
33
|
1
|
|
|
1
|
|
5
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
67
|
|
34
|
0
|
|
|
|
|
|
*{"$args{into}::values"} = \&Tie::ArrayAsHash::avalues; |
|
0
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# XXX on uninstall, delete symbol |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
# ABSTRACT: Emulate values(@array) on Perl < 5.12 |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__END__ |