line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
5
|
|
|
5
|
|
94
|
use 5.010001; |
|
5
|
|
|
|
|
20
|
|
2
|
5
|
|
|
5
|
|
37
|
use strict; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
114
|
|
3
|
5
|
|
|
5
|
|
27
|
use warnings; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
302
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Story::Interact::Harness; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
8
|
|
|
|
|
|
|
our $VERSION = '0.001013'; |
9
|
|
|
|
|
|
|
|
10
|
5
|
|
|
5
|
|
39
|
use Story::Interact::State (); |
|
5
|
|
|
|
|
18
|
|
|
5
|
|
|
|
|
149
|
|
11
|
|
|
|
|
|
|
|
12
|
5
|
|
|
5
|
|
2936
|
use Moo::Role; |
|
5
|
|
|
|
|
46289
|
|
|
5
|
|
|
|
|
40
|
|
13
|
5
|
|
|
5
|
|
1809
|
use Types::Common -types; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
39
|
|
14
|
5
|
|
|
5
|
|
69749
|
use URI::Query (); |
|
5
|
|
|
|
|
40334
|
|
|
5
|
|
|
|
|
128
|
|
15
|
5
|
|
|
5
|
|
41
|
use namespace::clean; |
|
5
|
|
|
|
|
15
|
|
|
5
|
|
|
|
|
49
|
|
16
|
|
|
|
|
|
|
|
17
|
5
|
|
|
5
|
|
5118
|
use constant DEBUG => !!$ENV{PERL_STORY_INTERACT_DEBUG}; |
|
5
|
|
|
|
|
16
|
|
|
5
|
|
|
|
|
440
|
|
18
|
5
|
|
50
|
5
|
|
34
|
use constant FIRST_PAGE => $ENV{PERL_STORY_INTERACT_START} // 'main'; |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
1494
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has 'state' => ( |
21
|
|
|
|
|
|
|
is => 'ro', |
22
|
|
|
|
|
|
|
isa => Object, |
23
|
9
|
|
|
9
|
|
258990
|
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
|
|
|
|
|
105
|
my $state = $self->state; |
36
|
45
|
100
|
|
|
|
194
|
if ( $page_id =~ /\A(.+)\?(.+)\z/ms ) { |
37
|
2
|
|
|
|
|
6
|
$page_id = $1; |
38
|
2
|
|
|
|
|
20
|
my $params = URI::Query->new( $2 )->hash; |
39
|
2
|
|
|
|
|
340
|
$state->params( $params ); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
else { |
42
|
43
|
|
|
|
|
909
|
$state->params( {} ); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
45
|
|
|
|
|
1369
|
return $self->page_source->get_page( $state, $page_id ); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |