Mendo/Linea.pm

filter: Statementstmt 96.3% 26 / 27 Branchbran 50.0% 1 / 2 Conditioncond 50.0% 2 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 8 / 8 Podpod 100% 5 / 5 totaltotal 87.5% 42 / 48 CC 4 SCAR 5.7
CC
4
Cov
88%
new
3.1
followed_by
2.1
BEGIN
1.0
CRAP 1.8
« Mendo/Jornada.pm ↑ Summary Mendo.pm »
1 package Don::Mendo::Linea;
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 Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 our $VERSION = "0.0.3";
8  
9 # Other recommended modules (uncomment to use):
10 # use IO::Prompt;
11 # use Perl6::Export;
12 # use Perl6::Slurp;
13 # use Perl6::Say;
14  
15  
16 # Module implementation here
17 834 ▶sub new {
Subroutine new: called CC=3 SCAR=11.2
Pod documented
18 834 my $class = shift;
19 834 ▶ my $character = shift || croak "No person";
Condition50%1/2
shift() || croak('No person')
l!l
8340
MC/DC0%0/1
shift() || croak('No person')
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
20 834 ▶ my $line = shift || croak "Nothing to say";
Condition50%1/2
shift() || croak('Nothing to say')
l!l
8340
MC/DC0%0/1
shift() || croak('Nothing to say')
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
21
22 834 my $self = { _personaje => $character,
23 _line => $line };
24  
25 834 bless $self, $class;
26 834 return $self;
27
28 }
29  
30 257 ▶sub say {
Subroutine say: called CC=1 SCAR=0.0
Pod documented
31 257 my $self = shift;
32 257 return $self->{'_line'};
33 }
34  
35 995 ▶sub character {
Subroutine character: called CC=1 SCAR=0.0
Pod documented
36 995 my $self = shift;
37 995 return $self->{'_personaje'};
38 }
39  
40 830 ▶sub follows {
Subroutine follows: called CC=1 SCAR=0.0
Pod documented
41 830 my $self = shift;
42 830 $self->{'_follows'} = shift;
43 }
44  
45 1 ▶sub followed_by {
Subroutine followed_by: called CC=2 SCAR=7.6
Pod documented
46 1 my $self = shift;
47 1 ▶ if ( $self->{'_follows'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_follows'}) { } 0 1 1
48 0 return $self->{'_follows'}->character();
49 } else {
50 1 return;
51 }
52 }
53  
54 1 1; # Magic true value required at end of module
55  
56  
57 =head1 NAME
58  
59 Don::Mendo::Linea - A single bit of a dialogue in a play
60  
61 =head1 VERSION
62  
63 This document describes Don::Mendo::Linea version 0.0.3.
64  
65  
66 =head1 SYNOPSIS
67  
68 use Don::Mendo;
69 use Don::Mendo::Linea;
70  
71 my $don_mendo = new Don::Mendo;
72 my $primera_jornada = $don_mendo->jornadas()->[0];
73 my $lines = $primera_jornada->lines_for_character();
74 my $first_line = $lines->[0];
75 print $first_line->character(), " ", $first_line->say(),
76  
77
78 =head1 DESCRIPTION
79  
80 A single bit in a play: who says the bit, and its (possibly formatted) content.
81  
82  
83 =head1 INTERFACE
84  
85 =head2 new( $character, $content)
86  
87 Creates the line; needs who said it and what
88  
89 =head2 say()
90  
91 Returns the dialog fragment
92  
93 =head2 character()
94  
95 Returns the actor
96  
97 =head2 follows( $next_line )
98  
99 Sets the line that follows this one.
100  
101 =head2 followed_by()
102  
103 Returns the name of the character that will issue the next line
104  
105 =head1 CONFIGURATION AND ENVIRONMENT
106  
107 None known. A bit of mastery and playfulness, I guess.
108  
109  
110 =head1 DEPENDENCIES
111  
112 Caffeine and beer.
113  
114  
115 =head1 INCOMPATIBILITIES
116  
117 Incompatible with serious people.
118  
119  
120 =head1 BUGS AND LIMITATIONS
121  
122 Limited to a single play... might be more general, but then it
123 wouldn't be "The revenge of Don Mendo", but the revenge of somebody else.
124  
125 Please report any bugs or feature requests to
126 C<bug-don-mendo@rt.cpan.org>, or through the web interface at
127 L<http://rt.cpan.org>.
128  
129  
130 =head1 AUTHOR
131  
132 JJ Merelo C<< <jj@merelo.net> >>
133  
134  
135 =head1 LICENCE AND COPYRIGHT
136  
137 Copyright (c) 2008, JJ Merelo C<< <jj@merelo.net> >>. All rights reserved.
138  
139 This module is free software; you can redistribute it and/or
140 modify it under the same terms as Perl itself. See L<perlartistic>.
141  
142  
143 =head1 DISCLAIMER OF WARRANTY
144  
145 BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
146 FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
147 OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
148 PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
149 EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
150 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
151 ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
152 YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
153 NECESSARY SERVICING, REPAIR, OR CORRECTION.
154  
155 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
156 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
157 REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE
158 LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
159 OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
160 THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
161 RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
162 FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
163 SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
164 SUCH DAMAGES.
165  
166 =cut
« Mendo/Jornada.pm ↑ Summary Mendo.pm »