line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
3
|
|
|
3
|
|
81988
|
use 5.008001; |
|
3
|
|
|
|
|
17
|
|
2
|
3
|
|
|
3
|
|
14
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
82
|
|
3
|
3
|
|
|
3
|
|
17
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
186
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Data::Fake::Text; |
6
|
|
|
|
|
|
|
# ABSTRACT: Fake text data generators |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.006'; |
9
|
|
|
|
|
|
|
|
10
|
3
|
|
|
3
|
|
20
|
use Exporter 5.57 qw/import/; |
|
3
|
|
|
|
|
39
|
|
|
3
|
|
|
|
|
237
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our @EXPORT = qw( |
13
|
|
|
|
|
|
|
fake_words |
14
|
|
|
|
|
|
|
fake_sentences |
15
|
|
|
|
|
|
|
fake_paragraphs |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
3
|
|
|
3
|
|
962
|
use Data::Fake::Core qw/_transform/; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
922
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my $LOREM; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
#pod =func fake_words |
23
|
|
|
|
|
|
|
#pod |
24
|
|
|
|
|
|
|
#pod $generator = fake_words(); # single "lorem" word |
25
|
|
|
|
|
|
|
#pod $generator = fake_words($n); # N "lorem" words, space separated |
26
|
|
|
|
|
|
|
#pod $generator = fake_words( fake_int(1, 3) ); # random number of them |
27
|
|
|
|
|
|
|
#pod |
28
|
|
|
|
|
|
|
#pod Returns a generator that provides space-separated L words as a |
29
|
|
|
|
|
|
|
#pod single scalar value. The argument is the number of words to return (or a |
30
|
|
|
|
|
|
|
#pod code reference to provide the number of words); the default is one. |
31
|
|
|
|
|
|
|
#pod |
32
|
|
|
|
|
|
|
#pod =cut |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub fake_words { |
35
|
20
|
|
|
20
|
1
|
12732
|
my ($count) = @_; |
36
|
20
|
100
|
|
|
|
56
|
$count = 1 unless defined $count; |
37
|
20
|
|
|
|
|
1124
|
require Text::Lorem; |
38
|
20
|
|
66
|
|
|
1393
|
$LOREM ||= Text::Lorem->new; |
39
|
20
|
|
|
20
|
|
123
|
return sub { scalar $LOREM->words( _transform($count) ) }; |
|
20
|
|
|
|
|
55
|
|
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
#pod =func fake_sentences |
43
|
|
|
|
|
|
|
#pod |
44
|
|
|
|
|
|
|
#pod $generator = fake_sentences(); # single fake sentence |
45
|
|
|
|
|
|
|
#pod $generator = fake_sentences($n); # N sentences |
46
|
|
|
|
|
|
|
#pod $generator = fake_sentences( fake_int(1, 3) ); # random number of them |
47
|
|
|
|
|
|
|
#pod |
48
|
|
|
|
|
|
|
#pod Returns a generator that provides L sentences as a single |
49
|
|
|
|
|
|
|
#pod scalar value. The argument is the number of sentences to return (or a code |
50
|
|
|
|
|
|
|
#pod reference to provide the number of sentences); the default is one. |
51
|
|
|
|
|
|
|
#pod |
52
|
|
|
|
|
|
|
#pod =cut |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub fake_sentences { |
55
|
8
|
|
|
8
|
1
|
10551
|
my ($count) = @_; |
56
|
8
|
100
|
|
|
|
26
|
$count = 1 unless defined $count; |
57
|
1
|
|
|
1
|
|
3
|
return sub { "" } |
58
|
8
|
100
|
|
|
|
21
|
if $count == 0; |
59
|
7
|
|
|
|
|
35
|
require Text::Lorem; |
60
|
7
|
|
33
|
|
|
32
|
$LOREM ||= Text::Lorem->new; |
61
|
7
|
|
|
7
|
|
33
|
return sub { scalar $LOREM->sentences( _transform($count) ) }; |
|
7
|
|
|
|
|
21
|
|
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
#pod =func fake_paragraphs |
65
|
|
|
|
|
|
|
#pod |
66
|
|
|
|
|
|
|
#pod $generator = fake_paragraphs(); # single fake paragraph |
67
|
|
|
|
|
|
|
#pod $generator = fake_paragraphs($n); # N paragraph |
68
|
|
|
|
|
|
|
#pod $generator = fake_paragraphs( fake_int(1, 3) ); # random number of them |
69
|
|
|
|
|
|
|
#pod |
70
|
|
|
|
|
|
|
#pod Returns a generator that provides L paragraphs as a single |
71
|
|
|
|
|
|
|
#pod scalar value. The argument is the number of paragraphs to return (or a |
72
|
|
|
|
|
|
|
#pod code reference to provide the number of paragraphs); the default is one. |
73
|
|
|
|
|
|
|
#pod |
74
|
|
|
|
|
|
|
#pod =cut |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub fake_paragraphs { |
77
|
8
|
|
|
8
|
1
|
12981
|
my ($count) = @_; |
78
|
8
|
100
|
|
|
|
22
|
$count = 1 unless defined $count; |
79
|
8
|
|
|
|
|
45
|
require Text::Lorem; |
80
|
8
|
|
33
|
|
|
20
|
$LOREM ||= Text::Lorem->new; |
81
|
8
|
|
|
8
|
|
41
|
return sub { scalar $LOREM->paragraphs( _transform($count) ) }; |
|
8
|
|
|
|
|
21
|
|
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
# vim: ts=4 sts=4 sw=4 et tw=75: |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
__END__ |