| 1 | package POE::Component::IRC::Plugin::SigFail; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 1 | our $VERSION = '1.001003'; # VERSION | |||||||||
| 7 | |||||||||||
| 8 | 1 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | ▶ | use Devel::TakeHashArgs; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 1 | ▶ | use POE::Component::IRC::Plugin qw(:ALL); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 0 | ▶ | sub new { | ||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 13 | 0 | my $class = shift; | |||||||||
| 14 | |||||||||||
| 15 | 0 | ▶ | get_args_as_hash( \@_, \ my %args, { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 16 | tag => qr/<irc_sigfail:([^>]+)>/, | ||||||||||
| 17 | messages => __make_sigfail_messages(), | ||||||||||
| 18 | extra => [], | ||||||||||
| 19 | sigfail => 1, | ||||||||||
| 20 | }, | ||||||||||
| 21 | [], # no mandatory args | ||||||||||
| 22 | [ qw(tag extra messages sigfail) ], | ||||||||||
| 23 | ) or croak $@; | ||||||||||
| 24 | |||||||||||
| 25 | 0 | push @{ $args{messages} }, @{ $args{extra} }; | |||||||||
| 26 | |||||||||||
| 27 | 0 | return bless \%args, $class; | |||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | 0 | ▶ | sub PCI_register { | ||||||||
|
Subroutine
PCI_register: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 31 | 0 | my ( $self, $irc ) = @_; | |||||||||
| 32 | 0 | $self->{irc} = $irc; | |||||||||
| 33 | 0 | $irc->plugin_register( $self, 'USER', qw(privmsg notice) ); | |||||||||
| 34 | 0 | return 1; | |||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | 0 | ▶ | sub PCI_unregister { | ||||||||
|
Subroutine
PCI_unregister: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 38 | 0 | my $self = shift; | |||||||||
| 39 | 0 | delete $self->{irc}; | |||||||||
| 40 | 0 | return 1; | |||||||||
| 41 | } | ||||||||||
| 42 | |||||||||||
| 43 | 0 | ▶ | sub U_privmsg { | ||||||||
|
Subroutine
U_privmsg: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 44 | 0 | my ( $self, undef, $out ) = @_; | |||||||||
| 45 | 0 | $self->_process( $out ); | |||||||||
| 46 | 0 | return PCI_EAT_NONE; | |||||||||
| 47 | } | ||||||||||
| 48 | |||||||||||
| 49 | 0 | ▶ | sub U_notice { | ||||||||
|
Subroutine
U_notice: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 50 | 0 | my ( $self, undef, $out ) = @_; | |||||||||
| 51 | 0 | $self->_process( $out ); | |||||||||
| 52 | 0 | return PCI_EAT_NONE; | |||||||||
| 53 | } | ||||||||||
| 54 | |||||||||||
| 55 | 0 | ▶ | sub _process { | ||||||||
|
Subroutine
_process: not called CC=3 SCAR=24.8
| |||||||||||
| 56 | 0 | my ( $self, $out ) = @_; | |||||||||
| 57 | 0 | ▶ | if ( my ( $message ) = $$out =~ /$self->{tag}/ ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 58 | 0 | $message = $self->{messages}[ rand @{ $self->{messages} } ] | |||||||||
| 59 | 0 | ▶ | if $self->{sigfail}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 60 | |||||||||||
| 61 | 0 | $$out =~ s/$self->{tag}/$message/g; | |||||||||
| 62 | } | ||||||||||
| 63 | } | ||||||||||
| 64 | |||||||||||
| 65 | 0 | ▶ | sub __make_sigfail_messages { | ||||||||
|
Subroutine
__make_sigfail_messages: not called CC=1 SCAR=6.9
| |||||||||||
| 66 | return [ | ||||||||||
| 67 | 0 | q|No idea|, | |||||||||
| 68 | q|No clue|, | ||||||||||
| 69 | q|Wtf is that?|, | ||||||||||
| 70 | q|Umm.. Google it|, | ||||||||||
| 71 | q|Come again?|, | ||||||||||
| 72 | q|Trying to be funny?|, | ||||||||||
| 73 | q|Umm, I gotta run, talk to you later!|, | ||||||||||
| 74 | q|Leave me alone|, | ||||||||||
| 75 | q|Do I have to know that?|, | ||||||||||
| 76 | q|My dum-dum wants gum-gum|, | ||||||||||
| 77 | q|Pay me!|, | ||||||||||
| 78 | q|Hold on a sec... just wait...umm I'll be right back!!|, | ||||||||||
| 79 | q|$SIG{FAIL}|, | ||||||||||
| 80 | q|Mooooooo-o-o|, | ||||||||||
| 81 | q|Huh?|, | ||||||||||
| 82 | q|Waddayawant?!|, | ||||||||||
| 83 | q|Yeah, right!! Keep on waiting!|, | ||||||||||
| 84 | q|*yawn*|, | ||||||||||
| 85 | q|Don't leave! I'm coming!|, | ||||||||||
| 86 | q|Where is my sugar?|, | ||||||||||
| 87 | q|I'm not that smart :(|, | ||||||||||
| 88 | q|lalalala-lala-lala|, | ||||||||||
| 89 | q|me iz teh suck, ask some1 else|, | ||||||||||
| 90 | q|must.... eat... batteries..|, | ||||||||||
| 91 | q|Something tells me you are trying to fool me...|, | ||||||||||
| 92 | q|NO! I will NOT tell you that!|, | ||||||||||
| 93 | q|Stop picking on bots, you racist!!|, | ||||||||||
| 94 | q|Do you have to bug me so much just because I am a bot?|, | ||||||||||
| 95 | q|01001011101111010000110101100011! Read that!|, | ||||||||||
| 96 | q|Not enough megahurts :(|, | ||||||||||
| 97 | q|Can't tell you, it's a secret!|, | ||||||||||
| 98 | q|Hrooop, something's broke!|, | ||||||||||
| 99 | q|If you don't know, why should I? >:O|, | ||||||||||
| 100 | ]; | ||||||||||
| 101 | } | ||||||||||
| 102 | |||||||||||
| 103 | 1 | 1; | |||||||||
| 104 | __END__ | ||||||||||