line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Book::Bilingual::Chapter; |
2
|
|
|
|
|
|
|
# ABSTRACT: A book chapter class |
3
|
4
|
|
|
4
|
|
1159
|
use Mojo::Base -base; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
25
|
|
4
|
4
|
|
|
4
|
|
748
|
use Carp; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
1110
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
has 'number'; |
7
|
|
|
|
|
|
|
has 'title'; |
8
|
|
|
|
|
|
|
has 'body'; |
9
|
|
|
|
|
|
|
|
10
|
48
|
|
|
48
|
1
|
2610
|
sub new { $_[0]->SUPER::new({ body => [] }) } |
11
|
|
|
|
|
|
|
sub num_paragraphs { |
12
|
1
|
|
|
1
|
0
|
12
|
my ($self) = @_; |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
|
|
1
|
return scalar @{$self->{body}}; |
|
1
|
|
|
|
|
3
|
|
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
sub dlineset_at { ## ($i) :> Dlineset |
17
|
9
|
|
|
9
|
0
|
38
|
my ($self,$i) = @_; |
18
|
9
|
100
|
|
|
|
25
|
return $self->number if $i == 0; |
19
|
7
|
100
|
|
|
|
17
|
return $self->title if $i == 1; |
20
|
5
|
|
|
|
|
12
|
return $self->body->[$i-2]; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
sub dlineset_count { |
23
|
7
|
|
|
7
|
0
|
35
|
my ($self) = @_; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
return (defined $self->number ? 1 : 0) |
26
|
|
|
|
|
|
|
+ (defined $self->title ? 1 : 0) |
27
|
7
|
50
|
|
|
|
16
|
+ scalar @{$self->{body}}; |
|
7
|
50
|
|
|
|
66
|
|
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |