line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Plack::Component; |
2
|
101
|
|
|
101
|
|
94941
|
use strict; |
|
101
|
|
|
|
|
200
|
|
|
101
|
|
|
|
|
2345
|
|
3
|
101
|
|
|
101
|
|
520
|
use warnings; |
|
101
|
|
|
|
|
164
|
|
|
101
|
|
|
|
|
1896
|
|
4
|
101
|
|
|
101
|
|
393
|
use Carp (); |
|
101
|
|
|
|
|
170
|
|
|
101
|
|
|
|
|
1638
|
|
5
|
101
|
|
|
101
|
|
22159
|
use Plack::Util; |
|
101
|
|
|
|
|
172
|
|
|
101
|
|
|
|
|
3702
|
|
6
|
101
|
|
|
101
|
|
545
|
use overload '&{}' => \&to_app_auto, fallback => 1; |
|
101
|
|
|
|
|
145
|
|
|
101
|
|
|
|
|
998
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
283
|
|
|
283
|
1
|
4796
|
my $proto = shift; |
10
|
283
|
|
33
|
|
|
2119
|
my $class = ref $proto || $proto; |
11
|
|
|
|
|
|
|
|
12
|
283
|
|
|
|
|
500
|
my $self; |
13
|
283
|
100
|
66
|
|
|
2535
|
if (@_ == 1 && ref $_[0] eq 'HASH') { |
14
|
208
|
|
|
|
|
347
|
$self = bless {%{$_[0]}}, $class; |
|
208
|
|
|
|
|
1051
|
|
15
|
|
|
|
|
|
|
} else { |
16
|
75
|
|
|
|
|
196
|
$self = bless {@_}, $class; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
283
|
|
|
|
|
967
|
$self; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub to_app_auto { |
23
|
131
|
|
|
131
|
0
|
214
|
my $self = shift; |
24
|
131
|
50
|
50
|
|
|
555
|
if (($ENV{PLACK_ENV} || '') eq 'development') { |
25
|
0
|
|
|
|
|
0
|
my $class = ref($self); |
26
|
0
|
|
|
|
|
0
|
warn "WARNING: Automatically converting $class instance to a PSGI code reference. " . |
27
|
|
|
|
|
|
|
"If you see this warning for each request, you probably need to explicitly call " . |
28
|
|
|
|
|
|
|
"to_app() i.e. $class->new(...)->to_app in your PSGI file.\n"; |
29
|
|
|
|
|
|
|
} |
30
|
131
|
|
|
|
|
320
|
$self->to_app(@_); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# NOTE: |
34
|
|
|
|
|
|
|
# this is for back-compat only, |
35
|
|
|
|
|
|
|
# future modules should use |
36
|
|
|
|
|
|
|
# Plack::Util::Accessor directly |
37
|
|
|
|
|
|
|
# or their own favorite accessor |
38
|
|
|
|
|
|
|
# generator. |
39
|
|
|
|
|
|
|
# - SL |
40
|
|
|
|
|
|
|
sub mk_accessors { |
41
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
42
|
0
|
|
0
|
|
|
0
|
Plack::Util::Accessor::mk_accessors( ref( $self ) || $self, @_ ) |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
289
|
|
|
289
|
1
|
367
|
sub prepare_app { return } |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub to_app { |
48
|
344
|
|
|
344
|
1
|
707
|
my $self = shift; |
49
|
344
|
|
|
|
|
2114
|
$self->prepare_app; |
50
|
344
|
|
|
1099
|
|
2325
|
return sub { $self->call(@_) }; |
|
1099
|
|
|
|
|
8144
|
|
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub response_cb { |
55
|
761
|
|
|
761
|
1
|
6034
|
my($self, $res, $cb) = @_; |
56
|
761
|
|
|
|
|
14183
|
Plack::Util::response_cb($res, $cb); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |