line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Randf; |
2
|
2
|
|
|
2
|
|
161082
|
use strict; |
|
2
|
|
|
|
|
14
|
|
|
2
|
|
|
|
|
58
|
|
3
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
60
|
|
4
|
2
|
|
|
2
|
|
887
|
use Config::CmdRC '.randfrc'; |
|
2
|
|
|
|
|
43463
|
|
|
2
|
|
|
|
|
17
|
|
5
|
2
|
|
|
2
|
|
1940
|
use Getopt::Long qw/GetOptionsFromArray/; |
|
2
|
|
|
|
|
22801
|
|
|
2
|
|
|
|
|
13
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub run { |
10
|
1
|
|
|
1
|
1
|
2375
|
my $self = shift; |
11
|
1
|
|
|
|
|
3
|
my @argv = @_; |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
|
|
5
|
my $config = RC(); |
14
|
1
|
|
|
|
|
7
|
_merge_opt($config, @argv); |
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
|
|
5
|
_main($config); |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub _main { |
20
|
1
|
|
|
1
|
|
3
|
my $config = shift; |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
|
|
7
|
while (my $stdin = ) { |
23
|
100
|
100
|
66
|
|
|
847
|
print $stdin if !$config->{per} || $config->{per}*100 > rand(10000); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub _merge_opt { |
28
|
1
|
|
|
1
|
|
3
|
my ($config, @argv) = @_; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
GetOptionsFromArray( |
31
|
|
|
|
|
|
|
\@argv, |
32
|
|
|
|
|
|
|
'p|per=i' => \$config->{per}, |
33
|
|
|
|
|
|
|
'h|help' => sub { |
34
|
0
|
|
|
0
|
|
0
|
_show_usage(1); |
35
|
|
|
|
|
|
|
}, |
36
|
|
|
|
|
|
|
'v|version' => sub { |
37
|
0
|
|
|
0
|
|
0
|
print "$0 $VERSION\n"; |
38
|
0
|
|
|
|
|
0
|
exit 1; |
39
|
|
|
|
|
|
|
}, |
40
|
1
|
50
|
|
|
|
12
|
) or _show_usage(2); |
41
|
|
|
|
|
|
|
|
42
|
1
|
50
|
|
|
|
367
|
$config->{per} = shift @argv if scalar @argv > 0; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub _show_usage { |
46
|
1
|
|
|
1
|
|
1659
|
my $exitval = shift; |
47
|
|
|
|
|
|
|
|
48
|
1
|
|
|
|
|
564
|
require Pod::Usage; |
49
|
1
|
|
|
|
|
47998
|
Pod::Usage::pod2usage(-exitval => $exitval); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__END__ |