blib/lib/YATT/Lite/Test/TestFCGI.pm

filter: Statementstmt 30.9% 72 / 233 Branchbran 0.0% 0 / 96 Conditioncond 0.0% 0 / 12 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 50.0% 22 / 44 Podpod 0.0% 0 / 15 totaltotal 23.0% 94 / 408 CC 55 SCAR 42.1
CC
55
Cov
21%
request
306.0
fork_server
56.0
check_skip_reason
42.0
CRAP 67.0
« blib/lib/YATT/Lite/LanguageServer/SpecParser.pm ↑ Summary blib/lib/YATT/Lite/Util/CmdLine.pm »
1 # -*- coding: utf-8 -*-
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings qw(FATAL all NONFATAL misc);
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 # For future Test::FCGI::Mechanize...
6  
7 1 ▶use Test::Builder ();
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 my $Test = Test::Builder->new;
9  
10 {
11 package YATT::Lite::Test::TestFCGI; sub MY () {__PACKAGE__}
12 1 ▶ use parent qw(YATT::Lite::Object File::Spec);
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶ use YATT::Lite::MFields qw/_res _status _ct _content _cookie_jar _last_request
Subroutine BEGIN: called CC=1 SCAR=0.0
14 _sockfile
15 _raw_result
16 onerror
17 rootdir fcgiscript
18 debug_fcgi
19 _kidpid
20 1 /; # base form
21  
22 1 ▶ use HTML::Entities ();
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 0 ▶ sub check_skip_reason {
Subroutine check_skip_reason: not called CC=6 SCAR=37.4
Pod undocumented
25 0 my MY $self = shift;
26  
27 0 ▶ unless (eval {require FCGI and require CGI::Fast}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (eval { do { require FCGI and require CGI::Fast } }) 0 0 0
Condition0%0/3
require FCGI && require CGI::Fast
!ll&&!rl&&r
000
MC/DC0%0/2
require FCGI && require CGI::Fast
require FCGI require CGI::Fast
Truth table0%0/3
A && B
A= require FCGIB= require CGI::Fast
ABresult
0X0
100
111
28 0 return 'FCGI.pm is not installed';
29 }
30  
31 0 ▶ unless (eval {require HTTP::Response}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (eval { do { require HTTP::Response } }) 0 0 0
32 0 return 'HTTP::Response is not installed';
33 }
34  
35 0 ▶ if (ref $self and not -x $self->{fcgiscript}) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self and not -x $self->{"fcgiscript"}) 0 0 0
Condition0%0/3
ref $self and not -x $self->{"fcgiscript"}
!ll&&!rl&&r
000
MC/DC0%0/2
ref $self and not -x $self->{"fcgiscript"}
ref $self not -x $self->{"fcgiscript"}
Truth table0%0/3
A and not(B)
A= ref $selfB= not -x $self->{"fcgiscript"}
ABresult
0X0
100
111
36 0 return "Can't find cgi-bin/runyatt.cgi"
37 }
38  
39 0 return;
40 }
41  
42 0 ▶ sub plan {
Subroutine plan: not called CC=1 SCAR=6.9
Pod undocumented
43 0 shift;
44 0 require Test::More;
45 0 Test::More::plan(@_);
46 }
47  
48 0 ▶ sub skip_all {
Subroutine skip_all: not called CC=1 SCAR=6.9
Pod undocumented
49 0 shift;
50 0 require Test::More;
51 0 Test::More::plan(skip_all => shift);
52 }
53  
54 0 ▶ sub which {
Subroutine which: not called CC=3 SCAR=24.8
Pod undocumented
55 0 my ($pack, $exe) = @_;
56 0 foreach my $path ($pack->path) {
57 0 ▶ if (-x (my $fn = $pack->join($path, $exe))) {
Branch: 1 branch
BranchTrueFalseTotal
if (-x (my $fn = $pack->join($path, $exe))) 0 0 0
58 0 return $fn;
59 }
60 }
61 }
62  
63 1 ▶ use IO::Socket::UNIX;
Subroutine BEGIN: called CC=1 SCAR=0.0
64 1 ▶ use Fcntl;
Subroutine BEGIN: called CC=1 SCAR=0.0
65 1 ▶ use POSIX ":sys_wait_h";
Subroutine BEGIN: called CC=1 SCAR=0.0
66 1 ▶ use Time::HiRes qw(usleep);
Subroutine BEGIN: called CC=1 SCAR=0.0
67 1 ▶ use File::Basename;
Subroutine BEGIN: called CC=1 SCAR=0.0
68  
69 0 ▶ sub mkservsock {
Subroutine mkservsock: not called CC=1 SCAR=6.9
Pod undocumented
70 0 shift; new IO::Socket::UNIX(Local => shift, Listen => 5);
71 }
72 0 ▶ sub mkclientsock {
Subroutine mkclientsock: not called CC=1 SCAR=6.9
Pod undocumented
73 0 shift; new IO::Socket::UNIX(Peer => shift);
74 }
75  
76 0 ▶ sub fork_server {
Subroutine fork_server: not called CC=7 SCAR=40.3
Pod undocumented
77 0 (my MY $self) = @_;
78  
79 0 my $sessdir = MY->tmpdir . "/fcgitest$$";
80 0 ▶ unless (mkdir $sessdir, 0700) {
Branch: 1 branch
BranchTrueFalseTotal
unless (mkdir $sessdir, 448) 0 0 0
81 0 die "Can't mkdir $sessdir: $!";
82 }
83  
84 0 my $sock = $self->mkservsock($self->{_sockfile} = "$sessdir/socket");
85  
86 0 ▶ unless (defined($self->{_kidpid} = fork)) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined($self->{'_kidpid'} = fork)) { } 0 0 0
if (do { not $self->{"_kidpid"} }) 0 0 0
87 0 die "Can't fork: $!";
88 0 } elsif (not $self->{_kidpid}) {
89 # child
90 0 ▶ open STDIN, '<&', $sock or die "kid: Can't reopen STDIN: $!";
Branch: 1 branch
BranchTrueFalseTotal
open STDIN, "<&", $sock or die "kid: Can't reopen STDIN: $!" 0 0 0
91 0 ▶ open STDOUT, '>&', $sock or die "kid: Can't reopen STDOUT: $!";
Branch: 1 branch
BranchTrueFalseTotal
open STDOUT, ">&", $sock or die "kid: Can't reopen STDOUT: $!" 0 0 0
92 # open STDERR, '>&', $sock or die "kid: Can't reopen STDERR: $!";
93 # XXX: -MDevel::Cover=$ENV{HARNESS_PERL_SWITCHES}
94 # XXX: Taint?
95 0 my @opts = qw(-T);
96 0 ▶ if (my $switch = $ENV{HARNESS_PERL_SWITCHES}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $switch = $ENV{"HARNESS_PERL_SWITCHES"}) 0 0 0
97 0 push @opts, split " ", $switch;
98 }
99 0 exec $^X, @opts, $self->{fcgiscript};
100 0 die "Can't exec $self->{fcgiscript}: $!";
101 }
102 }
103  
104 0 ▶ DESTROY {
Subroutine DESTROY: not called CC=3 SCAR=24.8
105 0 (my MY $self) = @_;
106 0 ▶ if ($self->{_kidpid}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"_kidpid"}) 0 0 0
107 # print STDERR "# shutting down $self->{_kidpid}\n";
108 # Shutdown FCGI fcgiscript. TERM is ng.
109 0 kill USR1 => $self->{_kidpid};
110 0 waitpid($self->{_kidpid}, 0);
111  
112 0 ▶ if (-e $self->{_sockfile}) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $self->{"_sockfile"}) 0 0 0
113 # print STDERR "# removing sockfile $self->{_sockfile}\n";
114 0 unlink $self->{_sockfile};
115 0 rmdir dirname($self->{_sockfile});
116 }
117 }
118 }
119  
120 0 ▶ sub parse_result {
Subroutine parse_result: not called CC=3 SCAR=24.8
Pod undocumented
121 0 my MY $self = shift;
122 # print map {"#[[$_]]\n"} split /\n/, $result;
123 0 my $res = $self->{_res} = HTTP::Response->parse(shift);
124 0 ▶ if (defined $res) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $res) 0 0 0
125 0 $res->request($self->{_last_request});
126 0 ▶ $self->{_cookie_jar} //= do {
Condition0%0/3
$self->{"_cookie_jar"} //= do { require HTTP::Cookies; "HTTP::Cookies"->new }
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"_cookie_jar"} //= do { require HTTP::Cookies; "HTTP::Cookies"->new }
$self->{"_cookie_jar"} do { require HTTP::Cookies; "HTTP::Cookies"->new }
Truth table0%0/3
A //= B
A= $self->{"_cookie_jar"}B= do { require HTTP::Cookies; "HTTP::Cookies"->new }
ABresult
1X1
011
000
127 0 require HTTP::Cookies;
128 0 HTTP::Cookies->new();
129 };
130 0 $self->{_cookie_jar}->extract_cookies($res);
131 }
132 0 $res;
133 }
134  
135 0 ▶ sub bake_cookies {
Subroutine bake_cookies: not called CC=2 SCAR=17.9
Pod undocumented
136 0 my MY $self = shift;
137 0 ▶ return unless $self->{_cookie_jar};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"_cookie_jar"} 0 0 0
138 0 $self->{_cookie_jar}->add_cookie_header($self->{_last_request});
139 0 $self->{_last_request}->header('Cookie');
140 }
141  
142 # Poor-man's emulation of WWW::Mechanize.
143 # These members are readonly from client.
144 # ($self->cookie_jar($x) has no results)
145 0 ▶ sub cookie_jar {
Subroutine cookie_jar: not called CC=1 SCAR=6.9
Pod undocumented
146 0 my MY $self = shift; $self->{_cookie_jar};
147 }
148  
149 0 ▶ sub content {
Subroutine content: not called CC=3 SCAR=24.8
Pod undocumented
150 0 my MY $self = shift;
151 0 ▶ unless (defined $self->{_res}) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $self->{'_res'}) { } 0 0 0
if (do { ref $self->{'_res'} }) { } 0 0 0
152 0 undef;
153 } elsif (ref $self->{_res}) {
154 0 $self->{_res}->content;
155 } else {
156 0 $self->{_res};
157 }
158 }
159  
160 0 ▶ sub title {
Subroutine title: not called CC=3 SCAR=24.8
Pod undocumented
161 0 my MY $self = shift;
162 0 ▶ defined (my $res = $self->content) or return undef;
Branch: 1 branch
BranchTrueFalseTotal
defined(my $res = $self->content) or return undef 0 0 0
163 0 ▶ my ($title) = $res =~ m{<title>(.*?)</title>}s or return $res;
Branch: 1 branch
BranchTrueFalseTotal
my($title) = $res =~ m[<title>(.*?)</title>]s or return $res 0 0 0
164 0 HTML::Entities::decode_entities($title);
165 }
166  
167 0 ▶ sub decode_entities {
Subroutine decode_entities: not called CC=1 SCAR=6.9
Pod undocumented
168 0 (my MY $self, my $str) = @_;
169 0 HTML::Entities::decode_entities($str);
170 }
171  
172 0 ▶ sub content_nocr {
Subroutine content_nocr: not called CC=2 SCAR=17.9
Pod undocumented
173 0 my MY $self = shift;
174 0 ▶ defined (my $res = $self->content)
Branch: 1 branch
BranchTrueFalseTotal
defined(my $res = $self->content) or return undef 0 0 0
175 or return undef;
176  
177 0 $res =~ s/\r//g;
178 0 $res =~ s/\n+$/\n/;
179 0 $res;
180 }
181  
182 1 ▶ use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
183 1 ▶ use YATT::Lite::Util qw(encode_query);
Subroutine BEGIN: called CC=1 SCAR=0.0
184 0 ▶ sub is_coverage_mode {
Subroutine is_coverage_mode: not called CC=4 SCAR=30.0
Pod undocumented
185 0 my ($pack) = @_;
186 0 my $symtab = (my $root = \%::);
187 0 foreach my $ns (qw(Devel:: Cover::)) {
188 0 ▶ my $glob = $symtab->{$ns}
Branch: 1 branch
BranchTrueFalseTotal
my $glob = $symtab->{$ns} or return 0 0 0 0
189 or return 0;
190 0 $symtab = *{$glob}{HASH}
191 0 ▶ or return 0;
Branch: 1 branch
BranchTrueFalseTotal
$symtab = *{$glob;}{"HASH"} or return 0 0 0 0
192 }
193 0 return 1;
194 }
195 }
196  
197 #========================================
198 {
199 1 package
200 YATT::Lite::Test::TestFCGI::Auto; sub MY () {__PACKAGE__}
201 1 ▶ use parent qw(YATT::Lite::Test::TestFCGI);
Subroutine BEGIN: called CC=1 SCAR=0.0
202  
203 0 ▶ sub class {
Subroutine class: not called CC=3 SCAR=24.8
204 0 my $pack = shift;
205 0 ▶ if (eval {require FCGI::Client}) {
Branch: 2 branches
BranchTrueFalseTotal
if (eval { do { require FCGI::Client } }) { } 0 0 0
elsif ($pack->which('cgi-fcgi')) { } 0 0 0
206 0 'YATT::Lite::Test::TestFCGI::FCGIClient';
207 } elsif ($pack->which('cgi-fcgi')) {
208 0 'YATT::Lite::Test::TestFCGI::cgi_fcgi';
209 }
210 }
211 }
212  
213 {
214 1 package
215 YATT::Lite::Test::TestFCGI::FCGIClient; sub MY () {__PACKAGE__}
216 1 ▶ use parent qw(YATT::Lite::Test::TestFCGI);
Subroutine BEGIN: called CC=1 SCAR=0.0
217 1 ▶ use YATT::Lite::MFields qw(_connection _raw_error);
Subroutine BEGIN: called CC=1 SCAR=0.0
218  
219 0 ▶ sub fork_server {
Subroutine fork_server: not called CC=1 SCAR=6.9
220 0 my $self = shift;
221 0 local $ENV{GATEWAY_INTERFACE} = 'CGI/1.1';
222 0 $self->SUPER::fork_server(@_);
223 }
224  
225 0 ▶ sub check_skip_reason {
Subroutine check_skip_reason: not called CC=3 SCAR=24.8
226 0 my MY $self = shift;
227  
228 0 my $reason = $self->SUPER::check_skip_reason;
229 0 ▶ return $reason if $reason;
Branch: 1 branch
BranchTrueFalseTotal
if $reason 0 0 0
230  
231 0 ▶ unless (eval {require FCGI::Client}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (eval { do { require FCGI::Client } }) 0 0 0
232 0 return 'FCGI::Client is not installed';
233 }
234 return
235 0 }
236  
237 1 ▶ use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
238 1 ▶ use YATT::Lite::Util qw(terse_dump);
Subroutine BEGIN: called CC=1 SCAR=0.0
239 0 ▶ sub request {
Subroutine request: not called CC=17 SCAR=57.2
240 0 (my MY $self, my ($method, $path, $query, $want_error)) = @_;
241 0 ▶ croak "Should run fork_server before request" unless $self->{_kidpid};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"_kidpid"} 0 0 0
242  
243 0 require FCGI::Client;
244 my $client = FCGI::Client::Connection->new
245 (sock => $self->mkclientsock($self->{_sockfile})
246 0 ▶ , (timeout => (YATT::Lite::Util::is_debugging() ? 1800 :
Branch: 2 branches
BranchTrueFalseTotal
YATT::Lite::Util::is_debugging() ? : 0 0 0
$self->is_coverage_mode ? : 0 0 0
247 $self->is_coverage_mode ? 120 : 10))
248 );
249  
250 my $env = {REQUEST_METHOD => uc($method)
251 , GATEWAY_INTERFACE => "FCGI::Client"
252 , REQUEST_URI => $path
253 , PATH_INFO => $path
254 , DOCUMENT_ROOT => $self->{rootdir}
255 0 , PATH_TRANSLATED => "$self->{rootdir}$path"
256 , REDIRECT_STATUS => 200
257 };
258 0 my @content;
259 0 ▶ if (defined $query) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $query) 0 0 0
260 0 ▶ if ($env->{REQUEST_METHOD} eq 'GET') {
Branch: 2 branches
BranchTrueFalseTotal
if ($env->{'REQUEST_METHOD'} eq 'GET') { } 0 0 0
elsif ($env->{'REQUEST_METHOD'} eq 'POST') { } 0 0 0
261 0 $env->{QUERY_STRING} = $self->encode_query($query);
262 } elsif ($env->{REQUEST_METHOD} eq 'POST') {
263 0 $env->{CONTENT_TYPE} = 'application/x-www-form-urlencoded';
264 0 my $enc = $self->encode_query($query);
265 0 push @content, $enc;
266 0 $env->{CONTENT_LENGTH} = length($enc);
267 }
268 }
269  
270 0 $self->{_last_request} = do {
271 0 require HTTP::Request;
272 my $req = HTTP::Request->new($env->{REQUEST_METHOD}
273 0 , "http://localhost$path");
274 };
275  
276 0 ▶ if (my $cookies = $self->bake_cookies()) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $cookies = $self->bake_cookies) 0 0 0
277 0 $env->{HTTP_COOKIE} = $cookies;
278 }
279  
280 print STDERR "# FCGI_REQUEST: ", terse_dump($env, @content), "\n"
281 0 ▶ if $self->{debug_fcgi};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"debug_fcgi"} 0 0 0
282  
283 0 ($self->{_raw_result}, $self->{_raw_error}) = $client->request
284 ($env, @content);
285  
286 print STDERR "# FCGI_RAW_RESULT: ", terse_dump($self->{_raw_result}), "\n"
287 0 ▶ if $self->{debug_fcgi};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"debug_fcgi"} 0 0 0
288 print STDERR "# FCGI_RAW_ERROR: ", terse_dump($self->{_raw_error}), "\n"
289 0 ▶ if $self->{debug_fcgi};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"debug_fcgi"} 0 0 0
290  
291 0 ▶ if (defined $self->{_raw_error} and $self->{_raw_error} ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"_raw_error"} and $self->{"_raw_error"} ne "") 0 0 0
Condition0%0/3
defined $self->{"_raw_error"} and $self->{"_raw_error"} ne ""
!ll&&!rl&&r
000
MC/DC0%0/2
defined $self->{"_raw_error"} and $self->{"_raw_error"} ne ""
defined $self->{"_raw_error"} $self->{"_raw_error"} ne ""
Truth table0%0/3
A and B
A= defined $self->{"_raw_error"}B= $self->{"_raw_error"} ne ""
ABresult
0X0
100
111
292 0 ▶ if ($want_error) {
Branch: 1 branch
BranchTrueFalseTotal
if ($want_error) 0 0 0
293 0 $self->{_res} = $self->{_raw_error};
294 0 return;
295 }
296 0 print STDERR map {"# ERR: $_\n"} split /\r?\n/, $self->{_raw_error};
297 0 die "error occured: " . terse_dump($method, $path, $query);
298 }
299  
300 # print STDERR "# ANS: ", terse_dump($self->{_raw_result}, $self->{_raw_error}), "\n";
301  
302 0 ▶ unless (defined $self->{_raw_result}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"_raw_result"}) 0 0 0
303 0 $self->{_res} = undef;
304 0 return;
305 }
306  
307 # Status line を補う。
308 0 my $res = do {
309 0 ▶ if ($self->{_raw_result} =~ m{^HTTP/\d+\.\d+ \d+ }) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->{'_raw_result'} =~ m[^HTTP/\d+\.\d+ \d+ ]) { } 0 0 0
elsif ($self->{'_raw_result'} =~ /^Status: (\d+ .*)/) { } 0 0 0
310 $self->{_raw_result}
311 0 } elsif ($self->{_raw_result} =~ /^Status: (\d+ .*)/) {
312 0 "HTTP/1.0 $1\x0d\x0a$self->{_raw_result}"
313 } else {
314 0 "HTTP/1.0 200 Faked OK\x0d\x0a$self->{_raw_result}"
315 }
316 };
317 0 $self->parse_result($res);
318 }
319  
320 }
321  
322 #========================================
323 {
324 1 package
325 YATT::Lite::Test::TestFCGI::cgi_fcgi; sub MY () {__PACKAGE__}
326 1 ▶ use parent qw(YATT::Lite::Test::TestFCGI);
Subroutine BEGIN: called CC=1 SCAR=0.0
327 1 ▶ use YATT::Lite::MFields qw(_wrapper);
Subroutine BEGIN: called CC=1 SCAR=0.0
328  
329 0 ▶ sub check_skip_reason {
Subroutine check_skip_reason: not called CC=4 SCAR=30.0
330 0 my MY $self = shift;
331  
332 0 my $reason = $self->SUPER::check_skip_reason;
333 0 ▶ return $reason if $reason;
Branch: 1 branch
BranchTrueFalseTotal
if $reason 0 0 0
334  
335 0 ▶ $self->{_wrapper} = MY->which('cgi-fcgi')
Branch: 1 branch
BranchTrueFalseTotal
$self->{"_wrapper"} = "YATT::Lite::Test::TestFCGI::cgi_fcgi"->which("cgi-fcgi") or return "cgi-fcgi is not installed" 0 0 0
336 or return 'cgi-fcgi is not installed';
337  
338 0 ▶ unless (-x $self->{fcgiscript}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-x $self->{"fcgiscript"}) 0 0 0
339 0 return 'fcgi fcgiscript is not runnable';
340 }
341  
342 0 return;
343 }
344  
345 1 ▶ use File::Basename;
Subroutine BEGIN: called CC=1 SCAR=0.0
346 1 ▶ use IPC::Open2;
Subroutine BEGIN: called CC=1 SCAR=0.0
347  
348 0 ▶ sub request {
Subroutine request: not called CC=6 SCAR=37.4
349 0 (my MY $self, my ($method, $path, $query)) = @_;
350 # local $ENV{SERVER_SOFTWARE} = 'PERL_TEST_FCGI';
351 0 local $ENV{GATEWAY_INTERFACE} = 'CGI/1.1';
352 0 my $is_post = (local $ENV{REQUEST_METHOD} = uc($method)
353 =~ m{^(POST|PUT)$});
354 0 local $ENV{REQUEST_URI} = $path;
355 0 local $ENV{DOCUMENT_ROOT} = $self->{rootdir};
356 0 local $ENV{PATH_TRANSLATED} = "$self->{rootdir}$path";
357 0 ▶ local $ENV{QUERY_STRING} = $self->encode_query($query)
Branch: 1 branch
BranchTrueFalseTotal
unless $is_post 0 0 0
358 unless $is_post;
359 0 ▶ local $ENV{CONTENT_TYPE} = 'application/x-www-form-urlencoded'
Branch: 1 branch
BranchTrueFalseTotal
if $is_post 0 0 0
360 if $is_post;
361 0 my $enc = $self->encode_query($query);
362 0 ▶ local $ENV{CONTENT_LENGTH} = length $enc
Branch: 1 branch
BranchTrueFalseTotal
if $is_post 0 0 0
363 if $is_post;
364  
365 # XXX: open3
366 my $kid = open2 my $read, my $write
367 , $self->{_wrapper}, qw(-bind -connect) => $self->{_sockfile}
368 0 ▶ or die "Can't invoke $self->{_wrapper}: $!";
Branch: 1 branch
BranchTrueFalseTotal
my $kid = open2(my $read, my $write, $self->{"_wrapper"}, ("-bind", "-connect"), $self->{"_sockfile"}) or die qq[Can't invoke $self->{"_wrapper"}: $!] 0 0 0
369 0 ▶ if ($is_post) {
Branch: 1 branch
BranchTrueFalseTotal
if ($is_post) 0 0 0
370 0 print $write $enc;
371 }
372 0 close $write;
373  
374 #XXX: Status line?
375 #XXX: waitpid
376 0 $self->parse_result(do {local $/; <$read>});
377 }
378 }
379  
380 1 1;
« blib/lib/YATT/Lite/LanguageServer/SpecParser.pm ↑ Summary blib/lib/YATT/Lite/Util/CmdLine.pm »