line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
5
|
|
|
5
|
|
127
|
use 5.010001; |
|
5
|
|
|
|
|
21
|
|
2
|
5
|
|
|
5
|
|
34
|
use strict; |
|
5
|
|
|
|
|
17
|
|
|
5
|
|
|
|
|
117
|
|
3
|
5
|
|
|
5
|
|
30
|
use warnings; |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
336
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Story::Interact::Page; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
8
|
|
|
|
|
|
|
our $VERSION = '0.001014'; |
9
|
|
|
|
|
|
|
|
10
|
5
|
|
|
5
|
|
348
|
use Moo; |
|
5
|
|
|
|
|
68
|
|
|
5
|
|
|
|
|
42
|
|
11
|
5
|
|
|
5
|
|
1724
|
use Types::Common -types; |
|
5
|
|
|
|
|
20
|
|
|
5
|
|
|
|
|
39
|
|
12
|
5
|
|
|
5
|
|
65238
|
use namespace::clean; |
|
5
|
|
|
|
|
286
|
|
|
5
|
|
|
|
|
58
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
use overload ( |
15
|
0
|
|
|
0
|
|
0
|
q[bool] => sub { 1 }, |
16
|
0
|
|
|
0
|
|
0
|
q[""] => sub { shift->name }, |
17
|
5
|
|
|
|
|
177
|
fallback => 1, |
18
|
5
|
|
|
5
|
|
4709
|
); |
|
5
|
|
|
|
|
11
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has 'id' => ( |
21
|
|
|
|
|
|
|
is => 'ro', |
22
|
|
|
|
|
|
|
isa => Str, |
23
|
|
|
|
|
|
|
required => 1, |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has 'location' => ( |
27
|
|
|
|
|
|
|
is => 'rwp', |
28
|
|
|
|
|
|
|
isa => Str, |
29
|
|
|
|
|
|
|
predicate => 1, |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
has 'abstract' => ( |
33
|
|
|
|
|
|
|
is => 'rwp', |
34
|
|
|
|
|
|
|
isa => Str, |
35
|
|
|
|
|
|
|
predicate => 1, |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
has 'todo' => ( |
39
|
|
|
|
|
|
|
is => 'rwp', |
40
|
|
|
|
|
|
|
isa => Bool, |
41
|
|
|
|
|
|
|
default => 0, |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
has 'text' => ( |
45
|
|
|
|
|
|
|
is => 'ro', |
46
|
|
|
|
|
|
|
isa => ArrayRef->of( Str ), |
47
|
45
|
|
|
45
|
|
1933
|
builder => sub { [] }, |
48
|
|
|
|
|
|
|
); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
has 'next_pages' => ( |
51
|
|
|
|
|
|
|
is => 'ro', |
52
|
|
|
|
|
|
|
isa => ArrayRef->of( |
53
|
|
|
|
|
|
|
Tuple->of( |
54
|
|
|
|
|
|
|
NonEmptyStr, |
55
|
|
|
|
|
|
|
NonEmptyStr, |
56
|
|
|
|
|
|
|
Optional->of( HashRef ), |
57
|
|
|
|
|
|
|
), |
58
|
|
|
|
|
|
|
), |
59
|
45
|
|
|
45
|
|
19603
|
builder => sub { [] }, |
60
|
|
|
|
|
|
|
); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub add_text { |
63
|
65
|
|
|
65
|
0
|
139
|
my ( $self, $text ) = @_; |
64
|
65
|
|
|
|
|
260
|
my @chunks = split /\n\s*\n/sm, $text; |
65
|
65
|
|
|
|
|
703
|
s/(?:^\s+|\s+$)//g for @chunks; |
66
|
65
|
|
|
|
|
514
|
s/\s+/ /g for @chunks; |
67
|
65
|
|
|
|
|
156
|
push @{ $self->text }, @chunks; |
|
65
|
|
|
|
|
203
|
|
68
|
65
|
|
|
|
|
1406
|
return; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub add_next_page { |
72
|
74
|
|
|
74
|
0
|
154
|
my ( $self, $page_id, $desc, %extra ) = @_; |
73
|
74
|
|
|
|
|
98
|
push @{ $self->next_pages }, [ $page_id, $desc, \%extra ]; |
|
74
|
|
|
|
|
240
|
|
74
|
74
|
|
|
|
|
1510
|
return; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub reset_next_pages { |
78
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
79
|
0
|
|
|
|
|
|
my @r = @{ $self->next_pages }; |
|
0
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
@{ $self->next_pages } = (); |
|
0
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
return \@r; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |