line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::CGI::Multipart::Gen::Text; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
805
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
30
|
|
5
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
72
|
|
6
|
1
|
|
|
1
|
|
5
|
use Readonly; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
7
|
1
|
|
|
1
|
|
6
|
use Test::CGI::Multipart; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
10
|
|
8
|
1
|
|
|
1
|
|
1626
|
use Text::Lorem; |
|
1
|
|
|
|
|
828
|
|
|
1
|
|
|
|
|
15
|
|
9
|
1
|
|
|
1
|
|
32
|
use Scalar::Util qw(looks_like_number); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
72
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
7
|
use version; our $VERSION = qv('0.0.3'); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
9
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# Module implementation here |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Test::CGI::Multipart->register_callback(callback => \&_random_text_cb); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub _random_text_cb { |
18
|
8
|
|
|
8
|
|
13
|
my $href = shift; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# If the MIME type is not explicitly text/plain its not ours. |
21
|
8
|
100
|
|
|
|
35
|
return $href if !exists $href->{type}; |
22
|
7
|
100
|
|
|
|
28
|
return $href if $href->{type} ne 'text/plain'; |
23
|
|
|
|
|
|
|
|
24
|
6
|
100
|
|
|
|
25
|
return $href if exists $href->{value}; |
25
|
|
|
|
|
|
|
|
26
|
5
|
|
|
|
|
43
|
my $lorem = Text::Lorem->new; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
my $arg = sub { |
29
|
12
|
|
|
12
|
|
14
|
my $arg = shift; |
30
|
12
|
|
100
|
|
|
239
|
return exists $href->{$arg} && looks_like_number($href->{$arg}); |
31
|
5
|
|
|
|
|
45
|
}; |
32
|
|
|
|
|
|
|
|
33
|
5
|
100
|
|
|
|
15
|
$href->{value} |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
34
|
|
|
|
|
|
|
= &$arg('words') ? $lorem->words($href->{words}) |
35
|
|
|
|
|
|
|
: &$arg('sentences') ? $lorem->sentences($href->{sentences}) |
36
|
|
|
|
|
|
|
: &$arg('paragraphs') ? $lorem->paragraphs($href->{paragraphs}) |
37
|
|
|
|
|
|
|
: croak 'No words, sentences or paragraphs specified'; |
38
|
|
|
|
|
|
|
|
39
|
3
|
|
|
|
|
2500
|
delete $href->{words}; |
40
|
3
|
|
|
|
|
6
|
delete $href->{sentences}; |
41
|
3
|
|
|
|
|
6
|
delete $href->{paragraphs}; |
42
|
|
|
|
|
|
|
|
43
|
3
|
|
|
|
|
21
|
return $href; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; # Magic true value required at end of module |
48
|
|
|
|
|
|
|
__END__ |