Silly/OutputLOLCAT.pm

filter: Statementstmt 86.6% 13 / 15 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 90.0% 18 / 20 CC 1 SCAR 0.6
CC
1
Cov
87%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« Silly/LOLCAT.pm ↑ Summary
1 package Bot::Cobalt::Plugin::Silly::OutputLOLCAT;
2 $Bot::Cobalt::Plugin::Silly::OutputLOLCAT::VERSION = '0.031002';
3 1 ▶use strictures 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶use POE::Filter::Stackable;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use POE::Filter::Line;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use POE::Filter::LOLCAT;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 0 ▶use Bot::Cobalt::Common;
Subroutine BEGIN: called CC=1 SCAR=2.6
10  
11 sub FILTER () { 0 }
12  
13 sub new { bless [undef], shift }
14  
15 sub Cobalt_register {
16 my ($self, $core) = splice @_, 0, 2;
17
18 $core->plugin_register( $self, 'USER',
19 'message'
20 );
21
22 $core->log->info("Loaded");
23
24 PLUGIN_EAT_NONE
25 }
26  
27 sub Cobalt_unregister {
28 my ($self, $core) = splice @_, 0, 2;
29
30 $core->log->info("Unloaded");
31
32 PLUGIN_EAT_NONE
33 }
34  
35 sub Outgoing_message {
36 my ($self, $core) = splice @_, 0, 2;
37  
38 my $filter = $self->[FILTER] //= POE::Filter::Stackable->new(
39 Filters => [
40 POE::Filter::Line->new(),
41 POE::Filter::LOLCAT->new(),
42 ],
43 );
44  
45 $filter->get_one_start([${$_[2]}."\n"]);
46  
47 my $lol = $filter->get_one;
48  
49 my $cat = shift @$lol;
50 chomp($cat);
51  
52 ${$_[2]} = $cat;
53  
54 PLUGIN_EAT_NONE
55 }
56  
57 1;
58 __END__
« Silly/LOLCAT.pm ↑ Summary