line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Lingua::Shakespeare::Character; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
39
|
use Carp; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
673
|
|
4
|
6
|
|
|
6
|
|
39
|
use strict; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
3739
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub new { |
7
|
39
|
|
|
39
|
0
|
121
|
my $class = shift; |
8
|
39
|
|
|
|
|
56
|
my $name = shift; |
9
|
|
|
|
|
|
|
|
10
|
39
|
|
|
|
|
291
|
bless { value => 0, list => [], name => $name }, $class; |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub name { |
15
|
0
|
|
|
0
|
0
|
0
|
shift->{name} |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub value { |
19
|
4969
|
|
|
4969
|
0
|
21340
|
shift->{value} |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub assign { |
23
|
6134
|
|
|
6134
|
0
|
16551
|
my $self = shift; |
24
|
6134
|
|
|
|
|
16432
|
$self->{value} = shift; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub int_input { |
28
|
1
|
|
|
1
|
0
|
3
|
my $self = shift; |
29
|
|
|
|
|
|
|
|
30
|
1
|
|
|
|
|
7
|
my $num = ; |
31
|
|
|
|
|
|
|
|
32
|
1
|
50
|
|
|
|
22
|
croak $self->name . " had a heart attack" |
33
|
|
|
|
|
|
|
unless defined $num; |
34
|
|
|
|
|
|
|
|
35
|
1
|
|
|
|
|
4
|
chomp($num); |
36
|
|
|
|
|
|
|
|
37
|
1
|
50
|
|
|
|
5
|
croak $self->name . "'s heart whispered something that is not an integer" |
38
|
|
|
|
|
|
|
unless $num =~ /^-?\d+/; |
39
|
|
|
|
|
|
|
|
40
|
1
|
|
|
|
|
4
|
$self->{value} = $num; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub int_output { |
44
|
378
|
|
|
378
|
0
|
545
|
my $self = shift; |
45
|
|
|
|
|
|
|
|
46
|
378
|
|
|
|
|
1402
|
print $self->{value}; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub char_output { |
50
|
11111
|
|
|
11111
|
0
|
18842
|
my $self = shift; |
51
|
|
|
|
|
|
|
|
52
|
11111
|
|
|
|
|
77746
|
print chr($self->{value} & 255); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub char_input { |
56
|
20
|
|
|
20
|
0
|
29
|
my $self = shift; |
57
|
|
|
|
|
|
|
|
58
|
20
|
|
|
|
|
20
|
my $ch; |
59
|
20
|
100
|
|
|
|
86
|
$self->{value} = read(STDIN, $ch, 1) ? ord($ch) : -1; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub push { |
63
|
217
|
|
|
217
|
0
|
479
|
my $self = shift; |
64
|
217
|
|
|
|
|
990
|
push @{ $self->{list} }, shift; |
|
217
|
|
|
|
|
977
|
|
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub pop { |
68
|
217
|
|
|
217
|
0
|
444
|
my $self = shift; |
69
|
217
|
|
|
|
|
301
|
$self->{value} = pop @{ $self->{list} }; |
|
217
|
|
|
|
|
865
|
|
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1; |