File Coverage

lib/Don/Mendo/Linea.pm
Criterion Covered Total %
statement 24 25 96.0
branch 1 2 50.0
condition 2 6 33.3
subroutine 8 8 100.0
pod 5 5 100.0
total 40 46 86.9


line stmt bran cond sub pod time code
1             package Don::Mendo::Linea;
2              
3 1     1   6 use warnings;
  1         1  
  1         29  
4 1     1   5 use strict;
  1         2  
  1         29  
5 1     1   6 use Carp;
  1         1  
  1         345  
6              
7             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             sub new {
18 834     834 1 812 my $class = shift;
19 834   33     1423 my $character = shift || croak "No person";
20 834   33     1292 my $line = shift || croak "Nothing to say";
21            
22 834         1866 my $self = { _personaje => $character,
23             _line => $line };
24              
25 834         1382 bless $self, $class;
26 834         1538 return $self;
27            
28             }
29              
30             sub say {
31 257     257 1 235 my $self = shift;
32 257         824 return $self->{'_line'};
33             }
34              
35             sub character {
36 995     995 1 870 my $self = shift;
37 995         2523 return $self->{'_personaje'};
38             }
39              
40             sub follows {
41 830     830 1 782 my $self = shift;
42 830         1484 $self->{'_follows'} = shift;
43             }
44              
45             sub followed_by {
46 1     1 1 6 my $self = shift;
47 1 50       4 if ( $self->{'_follows'} ) {
48 0         0 return $self->{'_follows'}->character();
49             } else {
50 1         5 return;
51             }
52             }
53              
54             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, or through the web interface at
127             L.
128              
129              
130             =head1 AUTHOR
131              
132             JJ Merelo C<< >>
133              
134              
135             =head1 LICENCE AND COPYRIGHT
136              
137             Copyright (c) 2008, JJ Merelo C<< >>. 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.
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