line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Ref::List; |
2
|
|
|
|
|
|
|
BEGIN { |
3
|
1
|
|
|
1
|
|
26197
|
$Ref::List::VERSION = '0.002'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: Punctuation-free dereferencing of arrayrefs and hashrefs |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
10
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
47
|
|
9
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
6
|
use Carp qw(croak); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
69
|
|
12
|
1
|
|
|
1
|
|
7
|
use Scalar::Util qw(reftype); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
95
|
|
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
6
|
use base 'Exporter'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
263
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our (@EXPORT, @EXPORT_OK); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
@EXPORT = qw(list); |
19
|
|
|
|
|
|
|
@EXPORT_OK = qw(list); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub list ($) { |
22
|
4
|
|
|
4
|
1
|
1438
|
my $ref = shift; |
23
|
|
|
|
|
|
|
|
24
|
4
|
100
|
|
|
|
32
|
if (!defined($ref)) { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
25
|
1
|
|
|
|
|
4
|
return; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
elsif ( reftype($ref) eq 'ARRAY') { |
28
|
1
|
|
|
|
|
6
|
return @$ref; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
elsif ( reftype($ref) eq 'HASH') { |
31
|
1
|
|
|
|
|
8
|
return %$ref; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
else { |
34
|
1
|
|
|
|
|
39
|
croak "Not a hashref or arrayref"; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__END__ |