line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Lorem::More::Source; |
2
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
50
|
use warnings; |
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
439
|
|
4
|
8
|
|
|
8
|
|
46
|
use strict; |
|
8
|
|
|
|
|
14
|
|
|
8
|
|
|
|
|
323
|
|
5
|
|
|
|
|
|
|
|
6
|
8
|
|
|
8
|
|
43
|
use constant DEFAULT_PRIORITY => 2 ** 6; |
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
606
|
|
7
|
8
|
|
|
8
|
|
47
|
use Carp; |
|
8
|
|
|
|
|
11
|
|
|
8
|
|
|
|
|
3183
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
16
|
|
|
16
|
0
|
62
|
my $self = bless {}, shift; |
11
|
16
|
|
|
|
|
27
|
my $generator = shift; |
12
|
16
|
|
|
|
|
28
|
my $priority = shift; |
13
|
16
|
|
|
|
|
81
|
$self->{source} = []; |
14
|
|
|
|
|
|
|
|
15
|
16
|
50
|
|
|
|
56
|
$self->push($generator, $priority) if defined $generator; |
16
|
|
|
|
|
|
|
|
17
|
16
|
|
|
|
|
39
|
return $self; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub push { |
21
|
16
|
|
|
16
|
0
|
27
|
my $self = shift; |
22
|
16
|
|
|
|
|
23
|
my $generator = shift; |
23
|
16
|
|
50
|
|
|
96
|
my $priority = shift || DEFAULT_PRIORITY; |
24
|
16
|
|
|
|
|
41
|
$self->{source} = [ sort { $a->[1] cmp $b->[1] } @{ $self->{source} }, [ $generator, $priority ] ]; |
|
0
|
|
|
|
|
0
|
|
|
16
|
|
|
|
|
151
|
|
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub copy { |
28
|
9
|
|
|
9
|
0
|
16
|
my $self = shift; |
29
|
9
|
|
|
|
|
37
|
my $copy = new __PACKAGE__; |
30
|
9
|
|
|
|
|
19
|
for (@{ $self->{source} }) { |
|
9
|
|
|
|
|
32
|
|
31
|
9
|
|
|
|
|
17
|
$copy->push({ %{ $_->[0] } }, $->[1]); |
|
9
|
|
|
|
|
241
|
|
32
|
|
|
|
|
|
|
} |
33
|
9
|
|
|
|
|
34
|
return $copy; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub find { |
37
|
11259
|
|
|
11259
|
0
|
11691
|
my $self = shift; |
38
|
11259
|
|
|
|
|
12226
|
my $name = shift; |
39
|
|
|
|
|
|
|
|
40
|
11259
|
|
|
|
|
11882
|
for (@{ $self->{source} }) { |
|
11259
|
|
|
|
|
22350
|
|
41
|
11259
|
100
|
|
|
|
25825
|
next unless defined (my $generatelet = $_->[0]->{$name}); |
42
|
11258
|
100
|
|
|
|
33385
|
return $generatelet if ref $generatelet; |
43
|
3631
|
|
|
|
|
6048
|
return $self->find($generatelet); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
1
|
|
|
|
|
194
|
croak "couldn't find generatelet for \"$name\""; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |