line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
5
|
|
|
5
|
|
91
|
use 5.010001; |
|
5
|
|
|
|
|
18
|
|
2
|
5
|
|
|
5
|
|
45
|
use strict; |
|
5
|
|
|
|
|
18
|
|
|
5
|
|
|
|
|
112
|
|
3
|
5
|
|
|
5
|
|
24
|
use warnings; |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
287
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Story::Interact::Harness; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
8
|
|
|
|
|
|
|
our $VERSION = '0.001014'; |
9
|
|
|
|
|
|
|
|
10
|
5
|
|
|
5
|
|
58
|
use Story::Interact::State (); |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
145
|
|
11
|
|
|
|
|
|
|
|
12
|
5
|
|
|
5
|
|
2905
|
use Moo::Role; |
|
5
|
|
|
|
|
46219
|
|
|
5
|
|
|
|
|
31
|
|
13
|
5
|
|
|
5
|
|
1861
|
use Types::Common -types; |
|
5
|
|
|
|
|
21
|
|
|
5
|
|
|
|
|
46
|
|
14
|
5
|
|
|
5
|
|
69813
|
use URI::Query (); |
|
5
|
|
|
|
|
41025
|
|
|
5
|
|
|
|
|
135
|
|
15
|
5
|
|
|
5
|
|
52
|
use namespace::clean; |
|
5
|
|
|
|
|
17
|
|
|
5
|
|
|
|
|
54
|
|
16
|
|
|
|
|
|
|
|
17
|
5
|
|
|
5
|
|
5055
|
use constant DEBUG => !!$ENV{PERL_STORY_INTERACT_DEBUG}; |
|
5
|
|
|
|
|
15
|
|
|
5
|
|
|
|
|
459
|
|
18
|
5
|
|
50
|
5
|
|
45
|
use constant FIRST_PAGE => $ENV{PERL_STORY_INTERACT_START} // 'main'; |
|
5
|
|
|
|
|
15
|
|
|
5
|
|
|
|
|
1574
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has 'state' => ( |
21
|
|
|
|
|
|
|
is => 'ro', |
22
|
|
|
|
|
|
|
isa => Object, |
23
|
9
|
|
|
9
|
|
255095
|
builder => sub { Story::Interact::State->new }, |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has 'page_source' => ( |
27
|
|
|
|
|
|
|
is => 'ro', |
28
|
|
|
|
|
|
|
isa => Object, |
29
|
|
|
|
|
|
|
required => 1, |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub get_page { |
33
|
45
|
|
|
45
|
0
|
107
|
my ( $self, $page_id ) = @_; |
34
|
|
|
|
|
|
|
|
35
|
45
|
|
|
|
|
101
|
my $state = $self->state; |
36
|
45
|
100
|
|
|
|
188
|
if ( $page_id =~ /\A(.+)\?(.+)\z/ms ) { |
37
|
2
|
|
|
|
|
8
|
$page_id = $1; |
38
|
2
|
|
|
|
|
26
|
my $params = URI::Query->new( $2 )->hash; |
39
|
2
|
|
|
|
|
385
|
$state->params( $params ); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
else { |
42
|
43
|
|
|
|
|
942
|
$state->params( {} ); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
45
|
|
|
|
|
1427
|
return $self->page_source->get_page( $state, $page_id ); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |