| 1 | package Bot::Cobalt::Plugin::Silly::LOLCAT; | ||||||||||||||||||||
| 2 | 1 | $Bot::Cobalt::Plugin::Silly::LOLCAT::VERSION = '0.031001'; | |||||||||||||||||||
| 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 | 1 | ▶ | use Bot::Cobalt::Common; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | sub FILTER () { 0 } | ||||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 1 | ▶ | sub new { bless [undef], shift } | ||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | sub Cobalt_register { | ||||||||||||||||||||
| 16 | 0 | ▶ | my ($self, $core) = splice @_, 0, 2; | ||||||||||||||||||
|
Subroutine
Cobalt_register: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | 0 | $core->plugin_register( $self, 'SERVER', | |||||||||||||||||||
| 19 | 'public_cmd_lolcat' | ||||||||||||||||||||
| 20 | ); | ||||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | |||||||||||||||||||||
| 23 | 0 | $core->log->info("Loaded"); | |||||||||||||||||||
| 24 | 0 | return PLUGIN_EAT_NONE | |||||||||||||||||||
| 25 | } | ||||||||||||||||||||
| 26 | |||||||||||||||||||||
| 27 | sub Cobalt_unregister { | ||||||||||||||||||||
| 28 | 0 | ▶ | my ($self, $core) = splice @_, 0, 2; | ||||||||||||||||||
|
Subroutine
Cobalt_unregister: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 29 | 0 | $core->log->info("Unloaded"); | |||||||||||||||||||
| 30 | 0 | return PLUGIN_EAT_NONE | |||||||||||||||||||
| 31 | } | ||||||||||||||||||||
| 32 | |||||||||||||||||||||
| 33 | sub Bot_public_cmd_lolcat { | ||||||||||||||||||||
| 34 | 0 | ▶ | my ($self, $core) = splice @_, 0, 2; | ||||||||||||||||||
|
Subroutine
Bot_public_cmd_lolcat: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | 0 | my $msg = ${ $_[0] }; | |||||||||||||||||||
| 37 | 0 | my $context = $msg->context; | |||||||||||||||||||
| 38 | |||||||||||||||||||||
| 39 | 0 | my $str = decode_irc( join ' ', @{ $msg->message_array } ); | |||||||||||||||||||
| 40 | 0 | ▶ | $str ||= "Can I have a line to parse?"; | ||||||||||||||||||
|
Condition0%0/2
$str ||= "Can I have a line to parse?"
MC/DC0%0/1
$str ||= "Can I have a line to parse?"
$str
Truth table0%0/2
A
A= $str
| |||||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | 0 | ▶ | my $filter = $self->[FILTER] //= POE::Filter::Stackable->new( | ||||||||||||||||||
|
Condition0%0/3
$self->[0] //= "POE::Filter::Stackable"->new("Filters", ["POE::Filter::Line"->new, "POE::Filter::LOLCAT"->new])
MC/DC0%0/2
$self->[0] //= "POE::Filter::Stackable"->new("Filters", ["POE::Filter::Line"->new, "POE::Filter::LOLCAT"->new])
$self->[0]
"POE::Filter::Stackable"->new("Filters", ["POE::Filter::Line"->new, "POE::Filter::LOLCAT"->new])
Truth table0%0/3
A //= B
A= $self->[0]B= "POE::Filter::Stackable"->new("Filters", ["POE::Filter::Line"->new, "POE::Filter::LOLCAT"->new])
| |||||||||||||||||||||
| 43 | Filters => [ | ||||||||||||||||||||
| 44 | POE::Filter::Line->new(), | ||||||||||||||||||||
| 45 | POE::Filter::LOLCAT->new(), | ||||||||||||||||||||
| 46 | ], | ||||||||||||||||||||
| 47 | ); | ||||||||||||||||||||
| 48 | |||||||||||||||||||||
| 49 | 0 | $filter->get_one_start([$str."\n"]); | |||||||||||||||||||
| 50 | |||||||||||||||||||||
| 51 | 0 | my $lol = $filter->get_one; | |||||||||||||||||||
| 52 | |||||||||||||||||||||
| 53 | 0 | my $cat = shift @$lol; | |||||||||||||||||||
| 54 | 0 | chomp($cat); | |||||||||||||||||||
| 55 | |||||||||||||||||||||
| 56 | 0 | my $channel = $msg->channel; | |||||||||||||||||||
| 57 | 0 | ▶ | $core->send_event( 'send_message', | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 58 | $context, | ||||||||||||||||||||
| 59 | $channel, | ||||||||||||||||||||
| 60 | 'LOLCAT: '.$cat | ||||||||||||||||||||
| 61 | ) if $cat; | ||||||||||||||||||||
| 62 | |||||||||||||||||||||
| 63 | 0 | return PLUGIN_EAT_ALL | |||||||||||||||||||
| 64 | } | ||||||||||||||||||||
| 65 | |||||||||||||||||||||
| 66 | 1 | 1; | |||||||||||||||||||
| 67 | __END__ | ||||||||||||||||||||