line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Graph::Easy::Util; |
2
|
|
|
|
|
|
|
|
3
|
48
|
|
|
48
|
|
162
|
use strict; |
|
48
|
|
|
|
|
55
|
|
|
48
|
|
|
|
|
1219
|
|
4
|
48
|
|
|
48
|
|
149
|
use warnings; |
|
48
|
|
|
|
|
47
|
|
|
48
|
|
|
|
|
1369
|
|
5
|
|
|
|
|
|
|
|
6
|
48
|
|
|
48
|
|
152
|
use base 'Exporter'; |
|
48
|
|
|
|
|
56
|
|
|
48
|
|
|
|
|
4951
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our @EXPORT_OK = (qw(first_kv ord_values)); |
9
|
|
|
|
|
|
|
|
10
|
48
|
|
|
48
|
|
189
|
use List::Util qw(minstr); |
|
48
|
|
|
|
|
52
|
|
|
48
|
|
|
|
|
9161
|
|
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
|
299
|
my $href = shift; |
23
|
|
|
|
|
|
|
|
24
|
306
|
|
|
|
|
917
|
my $n = minstr( keys(%$href) ); |
25
|
306
|
|
|
|
|
431
|
my $v = $href->{$n}; |
26
|
|
|
|
|
|
|
|
27
|
306
|
|
|
|
|
747
|
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
|
23825
|
my $href = shift; |
39
|
|
|
|
|
|
|
|
40
|
33710
|
100
|
100
|
|
|
113045
|
if ((!defined $href) || (! %$href)) |
41
|
|
|
|
|
|
|
{ |
42
|
8262
|
100
|
|
|
|
33960
|
return (wantarray ? () : 0); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
else |
45
|
|
|
|
|
|
|
{ |
46
|
25448
|
100
|
|
|
|
63374
|
return (wantarray ? @{$href}{sort keys( %$href )} : scalar(keys(%$href))); |
|
23730
|
|
|
|
|
56091
|
|
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
51
|
|
|
|
|
|
|
|