line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Graph::Easy::Util; |
2
|
|
|
|
|
|
|
|
3
|
49
|
|
|
49
|
|
298
|
use strict; |
|
49
|
|
|
|
|
93
|
|
|
49
|
|
|
|
|
2255
|
|
4
|
49
|
|
|
49
|
|
263
|
use warnings; |
|
49
|
|
|
|
|
103
|
|
|
49
|
|
|
|
|
2246
|
|
5
|
|
|
|
|
|
|
|
6
|
49
|
|
|
49
|
|
268
|
use base 'Exporter'; |
|
49
|
|
|
|
|
169
|
|
|
49
|
|
|
|
|
7901
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our @EXPORT_OK = (qw(first_kv ord_values)); |
9
|
|
|
|
|
|
|
|
10
|
49
|
|
|
49
|
|
317
|
use List::Util qw(minstr); |
|
49
|
|
|
|
|
156
|
|
|
49
|
|
|
|
|
14838
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 FUNCTIONS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head2 first_kv($hash_ref) |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
The first key value pair from a hash reference - lexicographically. |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=cut |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub first_kv |
21
|
|
|
|
|
|
|
{ |
22
|
306
|
|
|
306
|
1
|
674
|
my $href = shift; |
23
|
|
|
|
|
|
|
|
24
|
306
|
|
|
|
|
1723
|
my $n = minstr( keys(%$href) ); |
25
|
306
|
|
|
|
|
813
|
my $v = $href->{$n}; |
26
|
|
|
|
|
|
|
|
27
|
306
|
|
|
|
|
1665
|
return ($n, $v); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head2 ord_values($hash_ref) |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
The values of the hash ordered by a lexicographical keyname. |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=cut |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub ord_values |
37
|
|
|
|
|
|
|
{ |
38
|
33710
|
|
|
33710
|
1
|
53666
|
my $href = shift; |
39
|
|
|
|
|
|
|
|
40
|
33710
|
100
|
100
|
|
|
235397
|
if ((!defined $href) || (! %$href)) |
41
|
|
|
|
|
|
|
{ |
42
|
8262
|
100
|
|
|
|
83236
|
return (wantarray ? () : 0); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
else |
45
|
|
|
|
|
|
|
{ |
46
|
25448
|
100
|
|
|
|
130109
|
return (wantarray ? @{$href}{sort keys( %$href )} : scalar(keys(%$href))); |
|
23730
|
|
|
|
|
138674
|
|
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
51
|
|
|
|
|
|
|
|