line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package Outhentic::Story; |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
37
|
|
5
|
1
|
|
|
1
|
|
6
|
use base 'Exporter'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1256
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our @EXPORT = qw{ |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
new_story end_of_story |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
get_prop set_prop |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
debug_mod1 debug_mod2 debug_mod12 |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
set_stdout |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
context_populated |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
captures capture reset_captures |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
set_block_mode unset_block_mode in_block_mode |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
run_story apply_story_vars story_var |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
do_perl_file |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
ignore_story_err |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
project_root_dir |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
test_root_dir |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
runner_debug |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
}; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
our @stories = (); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub new_story { |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
0
|
0
|
|
push @stories, { |
42
|
|
|
|
|
|
|
context_populated => 0, |
43
|
|
|
|
|
|
|
captures => [], |
44
|
|
|
|
|
|
|
block_mode => 0, |
45
|
|
|
|
|
|
|
story_vars => {}, |
46
|
|
|
|
|
|
|
props => { ignore_story_err => 0 }, |
47
|
|
|
|
|
|
|
}; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub end_of_story { |
52
|
|
|
|
|
|
|
|
53
|
0
|
0
|
|
0
|
0
|
|
if (debug_mod12()){ |
54
|
0
|
|
|
|
|
|
Test::More::ok(1,"end of story: ".(get_prop('story'))); |
55
|
|
|
|
|
|
|
} |
56
|
0
|
|
|
|
|
|
delete $stories[-1]; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub _story { |
61
|
0
|
|
|
0
|
|
|
@stories[-1]; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub get_prop { |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
0
|
0
|
|
my $name = shift; |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
_story()->{props}->{$name}; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub set_prop { |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
|
0
|
0
|
|
my $name = shift; |
75
|
0
|
|
|
|
|
|
my $value = shift; |
76
|
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
|
_story()->{props}->{$name} = $value; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub project_root_dir { |
82
|
0
|
|
|
0
|
0
|
|
get_prop('project'); |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub test_root_dir { |
86
|
0
|
|
|
0
|
0
|
|
get_prop('test_root_dir'); |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub ignore_story_err { |
90
|
|
|
|
|
|
|
|
91
|
0
|
|
|
0
|
0
|
|
my $val = shift; |
92
|
0
|
|
|
|
|
|
my $rv; |
93
|
|
|
|
|
|
|
|
94
|
0
|
0
|
|
|
|
|
if (defined $val){ |
95
|
0
|
|
|
|
|
|
set_prop('ignore_story_err',$val); |
96
|
|
|
|
|
|
|
} else { |
97
|
0
|
|
|
|
|
|
$rv = get_prop('ignore_story_err'); |
98
|
|
|
|
|
|
|
} |
99
|
0
|
|
|
|
|
|
$rv; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub context_populated { |
104
|
0
|
|
|
0
|
0
|
|
get_prop('context_populated') |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub debug_mod1 { |
108
|
|
|
|
|
|
|
|
109
|
0
|
|
|
0
|
0
|
|
get_prop('debug') == 1 |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
sub debug_mod2 { |
113
|
|
|
|
|
|
|
|
114
|
0
|
|
|
0
|
0
|
|
get_prop('debug') == 2 |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
sub debug_mod12 { |
118
|
|
|
|
|
|
|
|
119
|
0
|
0
|
|
0
|
0
|
|
debug_mod1() or debug_mod2() |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub runner_debug { |
123
|
|
|
|
|
|
|
|
124
|
0
|
|
|
0
|
0
|
|
get_prop('runner_debug'); |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
sub set_stdout { |
129
|
0
|
|
|
0
|
0
|
|
set_prop('my_stdout', shift()); |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
sub captures { |
133
|
|
|
|
|
|
|
|
134
|
0
|
|
|
0
|
0
|
|
get_prop('captures'); |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
sub capture { |
138
|
0
|
|
|
0
|
0
|
|
captures()->[0] |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
sub reset_captures { |
143
|
0
|
|
|
0
|
0
|
|
set_prop(captures => []); |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
sub set_block_mode { |
147
|
0
|
|
|
0
|
0
|
|
set_prop(block_mode => 1); |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
sub unset_block_mode { |
152
|
0
|
|
|
0
|
0
|
|
set_prop(block_mode => 0); |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
} |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
sub in_block_mode { |
157
|
0
|
|
|
0
|
0
|
|
get_prop('block_mode'); |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
sub run_story { |
162
|
|
|
|
|
|
|
|
163
|
0
|
|
|
0
|
0
|
|
my $path = shift; |
164
|
0
|
|
0
|
|
|
|
my $story_vars = shift || {}; |
165
|
|
|
|
|
|
|
|
166
|
0
|
|
|
|
|
|
$main::story_vars = $story_vars; |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
|
169
|
0
|
|
|
|
|
|
my $test_root_dir = get_prop('test_root_dir'); |
170
|
0
|
|
|
|
|
|
my $project_root_dir = get_prop('project_root_dir'); |
171
|
|
|
|
|
|
|
|
172
|
0
|
|
|
|
|
|
my $test_file = "$test_root_dir/$project_root_dir/modules/$path/story.d"; |
173
|
|
|
|
|
|
|
|
174
|
0
|
0
|
|
|
|
|
die "test file: $test_file does not exist" unless -e $test_file; |
175
|
|
|
|
|
|
|
|
176
|
0
|
0
|
|
|
|
|
if (debug_mod12()){ |
177
|
0
|
|
|
|
|
|
Test::More::ok(1,"run downstream story: $path"); |
178
|
|
|
|
|
|
|
} |
179
|
|
|
|
|
|
|
|
180
|
0
|
|
|
|
|
|
do_perl_file($test_file); |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
} |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
sub do_perl_file { |
185
|
|
|
|
|
|
|
|
186
|
0
|
|
|
0
|
0
|
|
my $file = shift; |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
{ |
189
|
0
|
|
|
|
|
|
package main; |
190
|
0
|
|
|
|
|
|
my $return; |
191
|
0
|
0
|
|
|
|
|
unless ($return = do $file) { |
192
|
0
|
0
|
|
|
|
|
die "couldn't parse $file: $@" if $@; |
193
|
|
|
|
|
|
|
} |
194
|
|
|
|
|
|
|
} |
195
|
0
|
|
|
|
|
|
return 1; |
196
|
|
|
|
|
|
|
} |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
sub apply_story_vars { |
200
|
|
|
|
|
|
|
|
201
|
0
|
|
|
0
|
0
|
|
set_prop( story_vars => $main::story_vars ); |
202
|
|
|
|
|
|
|
} |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
sub story_var { |
205
|
|
|
|
|
|
|
|
206
|
0
|
|
|
0
|
0
|
|
my $name = shift; |
207
|
0
|
|
|
|
|
|
get_prop( 'story_vars' )->{$name}; |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
} |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
1; |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
__END__ |