IPMessenger/ToStdoutEventHandler.pm

filter: Statementstmt 46.9% 23 / 49 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 58.3% 7 / 12 Podpod 100% 5 / 5 totaltotal 53.0% 35 / 66 CC 1 SCAR 3.5
CC
1
Cov
47%
output
2.0
debug
2.0
BR_ENTRY
2.0
CRAP 1.4
« IPMessenger/EventHandler.pm ↑ Summary
1 package Net::IPMessenger::ToStdoutEventHandler;
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 1 ▶use Encode qw( from_to );
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use IO::Socket;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use POSIX;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Term::ANSIColor qw(:constants);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 $Term::ANSIColor::AUTORESET = 1;
10 1 ▶use base qw( Net::IPMessenger::EventHandler );
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 0 ▶sub output {
Subroutine output: not called CC=1 SCAR=6.9
Pod documented
13 0 my $str = shift;
14 0 from_to($str, 'shiftjis', 'euc-jp');
15 0 my $time = strftime("%Y-%m-%d %H:%M:%S", localtime);
16 0 print YELLOW "At \"$time\", " . $str;
17 0 print RESET "\n";
18 }
19  
20 0 ▶sub debug {
Subroutine debug: not called CC=1 SCAR=6.9
Pod documented
21 0 my $self = shift;
22 0 my $them = shift;
23 0 my $user = shift;
24  
25 0 my $peeraddr = inet_ntoa( $them->socket->peeraddr );
26 0 my $peerport = $them->socket->peerport;
27 0 my $command = $them->messagecommand( $user->command );
28 0 my $modename = $command->modename;
29  
30 0 print CYAN "Received $modename from [$peeraddr:$peerport]";
31 0 print RESET "\n";
32 }
33  
34 0 ▶sub BR_ENTRY {
Subroutine BR_ENTRY: not called CC=1 SCAR=6.9
Pod documented
35 0 my $self = shift;
36 0 my $them = shift;
37 0 my $user = shift;
38  
39 0 output($user->nickname . " joined.");
40 }
41  
42 0 ▶sub BR_EXIT {
Subroutine BR_EXIT: not called CC=1 SCAR=6.9
Pod documented
43 0 my $self = shift;
44 0 my $them = shift;
45 0 my $user = shift;
46  
47 0 output($user->nickname . " left.");
48 }
49  
50 0 ▶sub SENDMSG {
Subroutine SENDMSG: not called CC=1 SCAR=6.9
Pod documented
51 0 my $self = shift;
52 0 my $them = shift;
53 0 my $user = shift;
54  
55 0 output("you got message from " . $user->nickname . " .\a");
56 }
57  
58 1 1;
59 __END__
« IPMessenger/EventHandler.pm ↑ Summary