| 1 | package POE::Component::IRC::Plugin::Fortune; | ||||||||||
| 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 base 'POE::Component::IRC::Plugin::BaseWrap'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 0 | ▶ | sub _make_default_args { | ||||||||
|
Subroutine
_make_default_args: not called CC=1 SCAR=6.9
| |||||||||||
| 11 | return ( | ||||||||||
| 12 | 0 | trigger => qr/^(?=fortune$)/i, | |||||||||
| 13 | response_event => 'irc_fortune', | ||||||||||
| 14 | call => [ qw/fortune -s -n 300/ ], | ||||||||||
| 15 | ); | ||||||||||
| 16 | } | ||||||||||
| 17 | |||||||||||
| 18 | 0 | ▶ | sub _make_response_message { | ||||||||
|
Subroutine
_make_response_message: not called CC=2 SCAR=17.9
| |||||||||||
| 19 | 0 | my ( $self, $in_ref ) = @_; | |||||||||
| 20 | 0 | my $nick = (split /!/, $in_ref->{who})[0]; | |||||||||
| 21 | |||||||||||
| 22 | 0 | open my $fh, "-|", "@{ $self->{call} }" | |||||||||
| 23 | 0 | ▶ | or do { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | 0 | print "\nYou do not seem to have `fortune` program installed\n\n"; | |||||||||
| 25 | 0 | die "You do not seem to have `fortune` program installed [$!]"; | |||||||||
| 26 | }; | ||||||||||
| 27 | 0 | my $fortune = join " ", <$fh>; | |||||||||
| 28 | 0 | close $fh; | |||||||||
| 29 | 0 | $fortune =~ s/\s+/ /g; | |||||||||
| 30 | |||||||||||
| 31 | 0 | return [ "$nick, $fortune" ]; | |||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | 0 | ▶ | sub _message_into_response_event { 'fortune' } | ||||||||
|
Subroutine
_message_into_response_event: not called CC=1 SCAR=6.9
| |||||||||||
| 35 | |||||||||||
| 36 | 1 | 1; | |||||||||
| 37 | __END__ | ||||||||||