line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Petal::Utils::Each; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings::register; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
77
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
4
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
64
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
4
|
use base qw( Petal::Utils::Base ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
629
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
6
|
use constant name => 'each'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
67
|
|
11
|
1
|
|
|
1
|
|
5
|
use constant aliases => qw(); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
220
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = ((require Petal::Utils), $Petal::Utils::VERSION)[1]; |
14
|
|
|
|
|
|
|
our $REVISION = (split(/ /, ' $Revision: 1.2 $ '))[2]; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub process { |
17
|
1
|
|
|
1
|
0
|
30188
|
my $class = shift; |
18
|
1
|
|
|
|
|
3
|
my $hash = shift; |
19
|
1
|
|
33
|
|
|
6
|
my $args = shift || confess( "'each' expects a hash ref (got nothing)" ); |
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
|
|
9
|
my $result = $hash->fetch( $args ); |
22
|
|
|
|
|
|
|
|
23
|
1
|
50
|
|
|
|
163
|
confess( "1st arg to 'each' is not a hash ($args = $result)!" ) |
24
|
|
|
|
|
|
|
unless ref($result) eq 'HASH'; |
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
|
|
6
|
return [ map { { key => $_, val => $result->{$_} } } keys %$result ]; |
|
3
|
|
|
|
|
15
|
|
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
__END__ |