line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Randf; |
2
|
2
|
|
|
2
|
|
60614
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
56
|
|
3
|
2
|
|
|
2
|
|
7
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
56
|
|
4
|
2
|
|
|
2
|
|
1358
|
use Getopt::Long qw/GetOptionsFromArray/; |
|
2
|
|
|
|
|
18649
|
|
|
2
|
|
|
|
|
11
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub run { |
9
|
1
|
|
|
1
|
1
|
1984
|
my $self = shift; |
10
|
1
|
|
|
|
|
2
|
my @argv = @_; |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
|
|
2
|
my $config = +{}; |
13
|
1
|
|
|
|
|
3
|
_merge_opt($config, @argv); |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
|
|
4
|
_main($config); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub _main { |
19
|
1
|
|
|
1
|
|
6
|
my $config = shift; |
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
|
|
5
|
while (my $stdin = ) { |
22
|
100
|
100
|
66
|
|
|
610
|
print $stdin if !$config->{per} || $config->{per}*100 > rand(10000); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub _merge_opt { |
27
|
1
|
|
|
1
|
|
2
|
my ($config, @argv) = @_; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
GetOptionsFromArray( |
30
|
|
|
|
|
|
|
\@argv, |
31
|
|
|
|
|
|
|
'p|per=i' => \$config->{per}, |
32
|
|
|
|
|
|
|
'h|help' => sub { |
33
|
0
|
|
|
0
|
|
0
|
_show_usage(1); |
34
|
|
|
|
|
|
|
}, |
35
|
|
|
|
|
|
|
'v|version' => sub { |
36
|
0
|
|
|
0
|
|
0
|
print "$0 $VERSION\n"; |
37
|
0
|
|
|
|
|
0
|
exit 1; |
38
|
|
|
|
|
|
|
}, |
39
|
1
|
50
|
|
|
|
10
|
) or _show_usage(2); |
40
|
|
|
|
|
|
|
|
41
|
1
|
50
|
33
|
|
|
259
|
$config->{per} = shift @argv if scalar @argv > 0 && !$config->{per}; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub _show_usage { |
45
|
1
|
|
|
1
|
|
950
|
my $exitval = shift; |
46
|
|
|
|
|
|
|
|
47
|
1
|
|
|
|
|
568
|
require Pod::Usage; |
48
|
1
|
|
|
|
|
42410
|
Pod::Usage::pod2usage(-exitval => $exitval); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
__END__ |