line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Plack::Middleware::Acme::AAHTTPHeader; |
2
|
2
|
|
|
2
|
|
63009
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
58
|
|
3
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
68
|
|
4
|
2
|
|
|
2
|
|
426
|
use parent qw/Plack::Middleware/; |
|
2
|
|
|
|
|
308
|
|
|
2
|
|
|
|
|
10
|
|
5
|
2
|
|
|
2
|
|
14092
|
use Plack::Util; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
46
|
|
6
|
2
|
|
|
|
|
11
|
use Plack::Util::Accessor qw/ |
7
|
|
|
|
|
|
|
aa |
8
|
|
|
|
|
|
|
key |
9
|
2
|
|
|
2
|
|
9
|
/; |
|
2
|
|
|
|
|
4
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# https://www.asciiart.eu/holiday-and-events/4th-of-july |
14
|
|
|
|
|
|
|
my $DEFAULT_AA = <<'_TXT_'; |
15
|
|
|
|
|
|
|
. |
16
|
|
|
|
|
|
|
. . -:- . . . |
17
|
|
|
|
|
|
|
.'.:,'. . . . ' . . \ | / . |
18
|
|
|
|
|
|
|
.'.;.`. ._. ! ._. \ .__\:/__. |
19
|
|
|
|
|
|
|
`,:.' ._\!/_. .';`. . ' . |
20
|
|
|
|
|
|
|
,' . ! . ,., ..======.. .:. |
21
|
|
|
|
|
|
|
, . ._!_. ||::: : | . ', |
22
|
|
|
|
|
|
|
.====., . ; .~.===: : : :| ..===. |
23
|
|
|
|
|
|
|
|.::'|| .=====., ..=======.~, |"|: :|::::::| ||:::|=====| |
24
|
|
|
|
|
|
|
___| :::|!__., |:::::|!_, |: :: ::|"|l_l|"|:: |:;;:::|___!| ::|: : :| |
25
|
|
|
|
|
|
|
|: :|::: |:: |!__|; :: |: |===::: :: :|"||_||"| : |: :: :|: : |:: |:::::| |
26
|
|
|
|
|
|
|
|:::| _::|: :|:::|:===:|::|:::|:===F=:|"!/|\!"|::F|:====:|::_:|: :|::__:| |
27
|
|
|
|
|
|
|
!_[]![_]_!_[]![]_!_[__]![]![_]![_][I_]!//_:_\\![]I![_][_]!_[_]![]_!_[__]! |
28
|
|
|
|
|
|
|
-----------------------------------"---''''```---"----------------------- |
29
|
|
|
|
|
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |= _ _:_ _ =| _ _ _ _ _ _ _ _ _ _ _ _ |
30
|
|
|
|
|
|
|
|= : =| Valkyrie |
31
|
|
|
|
|
|
|
_____________________________________L___________J________________________ |
32
|
|
|
|
|
|
|
-------------------------------------------------------------------------- |
33
|
|
|
|
|
|
|
_TXT_ |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub prepare_app { |
36
|
2
|
|
|
2
|
1
|
3926
|
my $self = shift; |
37
|
|
|
|
|
|
|
|
38
|
2
|
100
|
|
|
|
7
|
if (!$self->aa) { |
|
|
50
|
|
|
|
|
|
39
|
1
|
|
|
|
|
64
|
$self->aa([split /(?:\r\n|\n|\r)/, $DEFAULT_AA]); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
elsif (ref($self->aa) ne 'ARRAY') { |
42
|
1
|
|
|
|
|
15
|
$self->aa([split /(?:\r\n|\n|\r)/, $self->aa]); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
2
|
100
|
|
|
|
39
|
$self->key or $self->key('happy') |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub call { |
49
|
2
|
|
|
2
|
1
|
24250
|
my $self = shift; |
50
|
2
|
|
|
|
|
13
|
my $res = $self->app->(@_); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
$self->response_cb( |
53
|
|
|
|
|
|
|
$res, |
54
|
|
|
|
|
|
|
sub { |
55
|
2
|
|
|
2
|
|
41
|
my $res = shift; |
56
|
|
|
|
|
|
|
|
57
|
2
|
50
|
|
|
|
21
|
return if $res->[0] != 200; |
58
|
2
|
50
|
|
|
|
6
|
return unless defined $res->[2]; |
59
|
|
|
|
|
|
|
|
60
|
2
|
|
|
|
|
5
|
my $headers = $res->[1]; |
61
|
|
|
|
|
|
|
|
62
|
2
|
|
|
|
|
3
|
my $count = 1; |
63
|
2
|
|
|
|
|
4
|
for my $line (@{$self->aa}) { |
|
2
|
|
|
|
|
8
|
|
64
|
27
|
|
|
|
|
65
|
Plack::Util::header_set( |
65
|
|
|
|
|
|
|
$headers, |
66
|
|
|
|
|
|
|
sprintf("x-%s%03d", $self->key, $count), |
67
|
|
|
|
|
|
|
$line |
68
|
|
|
|
|
|
|
); |
69
|
27
|
|
|
|
|
870
|
$count++; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
}, |
72
|
2
|
|
|
|
|
35
|
); |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
__END__ |