line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Puncheur::Runner; |
2
|
1
|
|
|
1
|
|
26625
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
32
|
|
3
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
717
|
use Plack::Runner; |
|
1
|
|
|
|
|
21223
|
|
|
1
|
|
|
|
|
36
|
|
6
|
1
|
|
|
1
|
|
49
|
use Plack::Util; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
384
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
4
|
|
|
4
|
0
|
13137
|
my ($class, $app, $plackup_options) = @_; |
10
|
4
|
|
50
|
|
|
17
|
$plackup_options ||= {}; |
11
|
4
|
|
|
|
|
22
|
$app = Plack::Util::load_class($app); |
12
|
4
|
|
|
|
|
827
|
my ($options, $argv); |
13
|
4
|
100
|
|
|
|
63
|
if ($app->can('parse_options')) { |
14
|
2
|
|
|
|
|
10
|
($options, $argv) = $app->parse_options(@ARGV); |
15
|
|
|
|
|
|
|
} |
16
|
4
|
100
|
|
|
|
28
|
$argv = [@ARGV] unless $argv; |
17
|
|
|
|
|
|
|
|
18
|
4
|
|
|
|
|
6
|
my @default; |
19
|
4
|
|
|
|
|
31
|
while (my ($key, $value) = each %$plackup_options) { |
20
|
8
|
|
|
|
|
49
|
push @default, "--$key=$value"; |
21
|
|
|
|
|
|
|
} |
22
|
4
|
|
|
|
|
31
|
my $runner = Plack::Runner->new; |
23
|
4
|
|
|
|
|
67
|
$runner->parse_options(@default, @$argv); |
24
|
|
|
|
|
|
|
|
25
|
4
|
100
|
|
|
|
21870
|
if (!$app->can('parse_options')) { |
26
|
2
|
|
|
|
|
6
|
my %options = @{ $runner->{options} }; |
|
2
|
|
|
|
|
11
|
|
27
|
2
|
|
|
|
|
12
|
delete $options{$_} for qw/listen socket/; |
28
|
2
|
|
|
|
|
7
|
$options = \%options; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
bless { |
32
|
4
|
|
|
|
|
36
|
app => $app, |
33
|
|
|
|
|
|
|
runner => $runner, |
34
|
|
|
|
|
|
|
app_options => $options, |
35
|
|
|
|
|
|
|
}, $class; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub run { |
39
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
40
|
0
|
0
|
|
|
|
|
my %opts = @_ == 1 ? %{$_[0]} : @_; |
|
0
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
my $app_options = $self->{app_options}; |
43
|
0
|
|
|
|
|
|
my $psgi = $self->{app}->new(%$app_options, %opts)->to_psgi; |
44
|
0
|
|
|
|
|
|
$self->{runner}->run($psgi); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |