lib/IRC/Bot/Hangman/Command/Default.pm

filter: Statementstmt 56.0% 14 / 25 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 62.5% 5 / 8 Podpod 100% 4 / 4 totaltotal 52.2% 23 / 44 CC 3 SCAR 15.0
CC
3
Cov
47%
play
12.0
quiet
2.0
talk
2.0
CRAP 4.5
« lib/IRC/Bot/Hangman/Command/Eliza.pm ↑ Summary lib/IRC/Bot/Hangman/Response.pm »
1 =head1 NAME
2  
3 IRC::Bot::Hangman::Command::Default - Default hangman commands
4  
5 =head1 SYNOPSIS
6  
7 See IRC::Bot::Hangman
8  
9 =head1 DESCRIPTION
10  
11 This module is a plugin providing
12 the implementation of the basics hangman commands.
13  
14 =head1 COMMANDS
15  
16 <letter>? : guess a letter
17 guess <letter> : guess a letter
18 guess <word> : guess an entire word
19 <hangman> help - help instructions
20 <hangman> play : Start a new game or display current game
21 <hangman> quiet : keep quite between guesses
22 <hangman> talk : Talk between guesses
23  
24 =cut
25  
26 package IRC::Bot::Hangman::Command::Default;
27 1 ▶use warnings::register;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 1 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
30 1 ▶use Carp qw( carp );
Subroutine BEGIN: called CC=1 SCAR=0.0
31  
32  
33 =head1 METHODS
34  
35 =head2 name()
36  
37 This plugin's name = 'default'
38  
39 =cut
40  
41 sub name () { 'default' }
42  
43  
44 =head2 commands()
45  
46 Commands provided by this plugin:
47  
48 play
49 quiet
50 talk
51  
52 =cut
53  
54 1 ▶sub commands () {
Subroutine commands: called CC=1 SCAR=0.0
Pod documented
55 return {
56 1 play => \&play,
57 quiet => \&quiet,
58 talk => \&talk,
59 };
60 }
61  
62  
63 =head1 COMMANDS
64  
65 =head2 play( robot )
66  
67 =cut
68  
69 0 ▶sub play {
Subroutine play: not called CC=3 SCAR=24.8
Pod documented
70 0 my $robot = shift;
71 0 ▶ if ($robot->game->lost or $robot->game->won) {
Branch: 1 branch
BranchTrueFalseTotal
if ($robot->game->lost or $robot->game->won) { } 0 0 0
Condition0%0/3
$robot->game->lost or $robot->game->won
l!l&&r!l&&!r
000
MC/DC0%0/2
$robot->game->lost or $robot->game->won
$robot->game->lost $robot->game->won
Truth table0%0/3
A or B
A= $robot->game->lostB= $robot->game->won
ABresult
1X1
011
000
72 0 $robot->new_game();
73 0 return;
74 }
75 else {
76 0 $robot->response( $robot->msg_guess() );
77 }
78 }
79  
80  
81 =head2 quiet( robot )
82  
83 =cut
84  
85 0 ▶sub quiet {
Subroutine quiet: not called CC=1 SCAR=6.9
Pod documented
86 0 my $robot = shift;
87 0 $robot->can_talk(0);
88 0 $robot->response( $robot->get_a_msg('quiet') );
89 }
90  
91  
92 =head2 talk( robot )
93  
94 =cut
95  
96 0 ▶sub talk {
Subroutine talk: not called CC=1 SCAR=6.9
Pod documented
97 0 my $robot = shift;
98 0 $robot->can_talk(1);
99 0 $robot->response( $robot->get_a_msg('talk') );
100 }
101  
102 1 1;
103  
104  
105 =head1 AUTHOR
106  
107 Pierre Denis <pierre@itrelease.net>
108  
109 http://www.itrelease.net/
110  
111 =head1 COPYRIGHT
112  
113 Copyright 2005 IT Release Ltd - All Rights Reserved.
114  
115 This module is released under the same license as Perl itself.
116  
117 =cut
« lib/IRC/Bot/Hangman/Command/Eliza.pm ↑ Summary lib/IRC/Bot/Hangman/Response.pm »