line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Acme::Taboo; |
2
|
2
|
|
|
2
|
|
32160
|
use 5.008005; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
84
|
|
3
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
77
|
|
4
|
2
|
|
|
2
|
|
21
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
674
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = "0.01"; |
7
|
|
|
|
|
|
|
our @CENSORED = ('xxx', '***', '???', '(CENSORED)'); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
1
|
|
|
1
|
0
|
16
|
my ($class, @list) = @_; |
11
|
1
|
|
|
|
|
6
|
bless [@list], $class; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub censor { |
15
|
1
|
|
|
1
|
0
|
6
|
my ($self, $str) = @_; |
16
|
1
|
|
|
|
|
3
|
my $taboo = my $replace = undef; |
17
|
1
|
|
|
|
|
8
|
for $taboo (@$self) { |
18
|
3
|
|
|
|
|
10
|
$replace = $self->_get_replace; |
19
|
3
|
|
|
|
|
63
|
$str =~ s{$taboo}{$replace}g; |
20
|
|
|
|
|
|
|
} |
21
|
1
|
|
|
|
|
8
|
return $str; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub _get_replace { |
25
|
3
|
|
|
3
|
|
5
|
my $self = shift; |
26
|
3
|
50
|
|
|
|
74
|
return rand(10) >= 7 ? $self->[int(rand($#{$self} + 1))] : $CENSORED[int(rand($#CENSORED + 1))] ; |
|
0
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
1; |
30
|
|
|
|
|
|
|
__END__ |