diff -Nru libmojolicious-plugin-cgi-perl-0.23/Changes libmojolicious-plugin-cgi-perl-0.25/Changes --- libmojolicious-plugin-cgi-perl-0.23/Changes 2015-07-16 05:43:59.000000000 +0000 +++ libmojolicious-plugin-cgi-perl-0.25/Changes 2015-11-27 10:49:54.000000000 +0000 @@ -1,5 +1,14 @@ Revision history for perl distribution Mojolicious-Plugin-CGI +0.25 2015-11-27T11:49:54+0100 + - Made post.t optional + +0.24 2015-11-11T22:16:33+0100 + - Add "run" option for running CGI code from a callback instead of script #17 + - Add HTTP_IF_NONE_MATCH to environement #17 + - Add support for reading the "Status" header + - Improved NPH script support #17 + 0.23 2015-07-16T07:43:59+0200 - Try to fix waiting for finished CGI scripts, without checking return value from waitpid() diff -Nru libmojolicious-plugin-cgi-perl-0.23/debian/changelog libmojolicious-plugin-cgi-perl-0.25/debian/changelog --- libmojolicious-plugin-cgi-perl-0.23/debian/changelog 2015-08-31 18:40:57.000000000 +0000 +++ libmojolicious-plugin-cgi-perl-0.25/debian/changelog 2015-12-02 20:35:17.000000000 +0000 @@ -1,3 +1,16 @@ +libmojolicious-plugin-cgi-perl (0.25-1) unstable; urgency=medium + + * Team upload. + * Rename autopkgtest configuration file(s) as per new pkg-perl- + autopkgtest schema. + * Import upstream version 0.25. + * Drop debian/tests/pkg-perl/smoke-skip. + The test we skipped is now optional and not run by default. + * debian/rules: remove override which skipped a test that is not run by + default anymore. + + -- gregor herrmann Wed, 02 Dec 2015 21:33:57 +0100 + libmojolicious-plugin-cgi-perl (0.23-1) unstable; urgency=medium * Team upload. diff -Nru libmojolicious-plugin-cgi-perl-0.23/debian/rules libmojolicious-plugin-cgi-perl-0.25/debian/rules --- libmojolicious-plugin-cgi-perl-0.23/debian/rules 2015-08-31 18:40:57.000000000 +0000 +++ libmojolicious-plugin-cgi-perl-0.25/debian/rules 2015-12-02 20:35:17.000000000 +0000 @@ -2,8 +2,3 @@ %: dh $@ - -override_dh_auto_test: - # skip leaky pipes test - # https://github.com/jhthorsen/mojolicious-plugin-cgi/issues/6 - DEBIAN_BUILD=1 dh_auto_test diff -Nru libmojolicious-plugin-cgi-perl-0.23/debian/tests/pkg-perl/skip-smoke libmojolicious-plugin-cgi-perl-0.25/debian/tests/pkg-perl/skip-smoke --- libmojolicious-plugin-cgi-perl-0.23/debian/tests/pkg-perl/skip-smoke 2015-08-31 18:40:57.000000000 +0000 +++ libmojolicious-plugin-cgi-perl-0.25/debian/tests/pkg-perl/skip-smoke 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -t/post.t diff -Nru libmojolicious-plugin-cgi-perl-0.23/lib/Mojolicious/Plugin/CGI.pm libmojolicious-plugin-cgi-perl-0.25/lib/Mojolicious/Plugin/CGI.pm --- libmojolicious-plugin-cgi-perl-0.23/lib/Mojolicious/Plugin/CGI.pm 2015-07-16 05:43:59.000000000 +0000 +++ libmojolicious-plugin-cgi-perl-0.25/lib/Mojolicious/Plugin/CGI.pm 2015-11-27 10:49:54.000000000 +0000 @@ -6,7 +6,7 @@ =head1 VERSION -0.23 +0.25 =head1 DESCRIPTION @@ -19,33 +19,60 @@ =head2 Standard usage use Mojolicious::Lite; + plugin CGI => [ "/cgi-bin/script" => "/path/to/cgi/script.pl" ]; + +Using the code above is enough to run C when accessing +L. + +=head2 Complex usage - plugin CGI => [ '/script' => '/path/to/cgi/script.pl' ]; plugin CGI => { - route => '/mount/point', - script => '/path/to/cgi/script.pl', + # Specify the script and mount point + script => "/path/to/cgi/script.pl", + route => "/some/route", + + # %ENV variables visible from inside the CGI script env => {}, # default is \%ENV - errlog => '/path/to/file.log', # path to where STDERR from cgi script goes - before => sub { # called before setup and script start + + # Path to where STDERR from cgi script goes + errlog => "/path/to/file.log", + + # The "before" hook is called before script start + # It receives a Mojolicious::Controller which can be modified + before => sub { my $c = shift; - # modify QUERY_STRING $c->req->url->query->param(a => 123); }, }; - app->start; +The above contains all the options you can pass on to the plugin. + +=head2 Running code refs + + plugin CGI => { + route => "/some/path", + run => sub { + my $cgi = CGI->new; + # ... + } + }; + +Instead of calling a script, you can run a code block when accessing the route. +This is (pretty much) safe, even if the code block modifies global state, +since it runs in a separate fork/process. =head2 Support for semicolon in query string - plugin CGI => { support_semicolon_in_query_string => 1 }; + plugin CGI => { + support_semicolon_in_query_string => 1, + ... + }; The code above need to be added before other plugins or handler which use L. It will inject a C hook which saves the original QUERY_STRING, before it is split on "&" in L. -This is an EXPERIMENTAL feature. - =cut use Mojo::Base 'Mojolicious::Plugin'; @@ -62,7 +89,7 @@ use constant READ => 0; use constant WRITE => 1; -our $VERSION = '0.23'; +our $VERSION = '0.25'; our %ORIGINAL_ENV = %ENV; =head1 ATTRIBUTES @@ -93,10 +120,10 @@ In addition to L, these dynamic variables are set: - CONTENT_LENGTH, CONTENT_TYPE, HTTP_COOKIE, HTTP_HOST, HTTP_REFERER, - HTTP_USER_AGENT, HTTPS, PATH, PATH_INFO, QUERY_STRING, REMOTE_ADDR, - REMOTE_HOST, REMOTE_PORT, REMOTE_USER, REQUEST_METHOD, SCRIPT_NAME, - SERVER_PORT, SERVER_PROTOCOL. + CONTENT_LENGTH, CONTENT_TYPE, HTTP_COOKIE, HTTP_HOST, HTTP_IF_NONE_MATCH, + HTTP_REFERER, HTTP_USER_AGENT, HTTPS, PATH, PATH_INFO, QUERY_STRING, + REMOTE_ADDR, REMOTE_HOST, REMOTE_PORT, REMOTE_USER, REQUEST_METHOD, + SCRIPT_NAME, SERVER_PORT, SERVER_PROTOCOL. Additional static variables: @@ -128,12 +155,13 @@ %{$self->env}, CONTENT_LENGTH => $content_length || 0, CONTENT_TYPE => $headers->content_type || '', - GATEWAY_INTERFACE => 'CGI/1.1', - HTTP_COOKIE => $headers->cookie || '', - HTTP_HOST => $headers->host || '', - HTTP_REFERER => $headers->referrer || '', - HTTP_USER_AGENT => $headers->user_agent || '', - HTTPS => $req->is_secure ? 'YES' : 'NO', + GATEWAY_INTERFACE => 'CGI/1.1', + HTTP_COOKIE => $headers->cookie || '', + HTTP_HOST => $headers->host || '', + HTTP_REFERER => $headers->referrer || '', + HTTP_USER_AGENT => $headers->user_agent || '', + HTTP_IF_NONE_MATCH => $headers->if_none_match || '', + HTTPS => $req->is_secure ? 'YES' : 'NO', #PATH => $req->url->path, PATH_INFO => '/' . ($c->stash('path_info') || ''), @@ -176,7 +204,11 @@ $self->{script} = shift @$args; } elsif ($args->{support_semicolon_in_query_string}) { - $app->hook(before_dispatch => sub { $_[0]->stash('cgi.query_string' => $_[0]->req->url->query->to_string); }); + $app->hook( + before_dispatch => sub { + $_[0]->stash('cgi.query_string' => $_[0]->req->url->query->to_string); + } + ); return; } else { @@ -203,8 +235,6 @@ defined($pid = fork) or die "[CGI] Could not fork $name: $!"; unless ($pid) { - - # No need to Mojo::IOLoop->reset, since the CGI script is started with exec() my @STDERR = @stderr ? ('>&', fileno $stderr[WRITE]) : ('>>', $self->{errlog}); warn "[CGI:$name:$$] <<< (@{[$stdin->slurp]})\n" if DEBUG; %ENV = $self->emulate_environment($c); @@ -215,10 +245,17 @@ $| = 1; select STDOUT; $| = 1; - { exec $self->{script} } - die "Could not execute $self->{script}: $!"; - } + if (my $code = $self->{run}) { + Mojo::IOLoop->reset; # clean up + $code->($c); + exit; + } + else { + { exec $self->{script} } + die "Could not execute $self->{script}: $!"; + } + } $log->debug("[CGI:$name:$pid] START $self->{script}"); $pids->{$pid} = $name; @@ -278,15 +315,15 @@ $buf .= $chunk; $buf =~ s/^(.*?\x0a\x0d?\x0a\x0d?)//s or return; # false until all headers has been read from the CGI script $headers = $1; - if ($headers =~ /^HTTP/) { + $c->res->code($1) if $headers =~ m!^HTTP (\d\d\d)!; # borked CGI response if SERVER_PROTOCOL has no version $c->res->parse($headers); } else { - $c->res->code($headers =~ /Location:/ ? 302 : 200); + $c->res->code($1) if $headers =~ /^Status: (\d\d\d)/m; + $c->res->code($headers =~ /Location:/ ? 302 : 200) unless $c->res->code; $c->res->parse($c->res->get_start_line_chunk(0) . $headers); } - $c->write($buf) if length $buf; }; } diff -Nru libmojolicious-plugin-cgi-perl-0.23/Makefile.PL libmojolicious-plugin-cgi-perl-0.25/Makefile.PL --- libmojolicious-plugin-cgi-perl-0.23/Makefile.PL 2015-07-16 05:43:59.000000000 +0000 +++ libmojolicious-plugin-cgi-perl-0.25/Makefile.PL 2015-11-27 10:49:54.000000000 +0000 @@ -23,5 +23,5 @@ 'Mojolicious' => '5.08' } , - test => {TESTS => (-e 'META.yml' ? 't/*.t' : 't/*.t xt/*.t')}, + test => { TESTS => 't/*.t' }, ); diff -Nru libmojolicious-plugin-cgi-perl-0.23/META.json libmojolicious-plugin-cgi-perl-0.25/META.json --- libmojolicious-plugin-cgi-perl-0.23/META.json 2015-07-16 05:44:00.000000000 +0000 +++ libmojolicious-plugin-cgi-perl-0.25/META.json 2015-11-27 10:49:55.000000000 +0000 @@ -4,7 +4,7 @@ "Jan Henning Thorsen " ], "dynamic_config" : 1, - "generated_by" : "ExtUtils::MakeMaker version 7.04, CPAN::Meta::Converter version 2.150001", + "generated_by" : "ExtUtils::MakeMaker version 7.0401, CPAN::Meta::Converter version 2.150001", "license" : [ "artistic_2" ], @@ -47,5 +47,5 @@ "url" : "https://github.com/jhthorsen/mojolicious-plugin-cgi.git" } }, - "version" : "0.23" + "version" : "0.25" } diff -Nru libmojolicious-plugin-cgi-perl-0.23/META.yml libmojolicious-plugin-cgi-perl-0.25/META.yml --- libmojolicious-plugin-cgi-perl-0.23/META.yml 2015-07-16 05:44:00.000000000 +0000 +++ libmojolicious-plugin-cgi-perl-0.25/META.yml 2015-11-27 10:49:54.000000000 +0000 @@ -7,7 +7,7 @@ configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 1 -generated_by: 'ExtUtils::MakeMaker version 7.04, CPAN::Meta::Converter version 2.150001' +generated_by: 'ExtUtils::MakeMaker version 7.0401, CPAN::Meta::Converter version 2.150001' license: artistic_2 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -24,4 +24,4 @@ bugtracker: https://github.com/jhthorsen/mojolicious-plugin-cgi/issues homepage: https://github.com/jhthorsen/mojolicious-plugin-cgi repository: https://github.com/jhthorsen/mojolicious-plugin-cgi.git -version: '0.23' +version: '0.25' diff -Nru libmojolicious-plugin-cgi-perl-0.23/README libmojolicious-plugin-cgi-perl-0.25/README --- libmojolicious-plugin-cgi-perl-0.23/README 2015-07-16 05:43:59.000000000 +0000 +++ libmojolicious-plugin-cgi-perl-0.25/README 2015-11-27 10:49:54.000000000 +0000 @@ -2,7 +2,7 @@ Mojolicious::Plugin::CGI - Run CGI script from Mojolicious VERSION - 0.23 + 0.25 DESCRIPTION This plugin enable Mojolicious to run Perl CGI scripts. It does so by @@ -12,32 +12,57 @@ SYNOPSIS Standard usage use Mojolicious::Lite; + plugin CGI => [ "/cgi-bin/script" => "/path/to/cgi/script.pl" ]; - plugin CGI => [ '/script' => '/path/to/cgi/script.pl' ]; + Using the code above is enough to run "script.pl" when accessing + . + + Complex usage plugin CGI => { - route => '/mount/point', - script => '/path/to/cgi/script.pl', + # Specify the script and mount point + script => "/path/to/cgi/script.pl", + route => "/some/route", + + # %ENV variables visible from inside the CGI script env => {}, # default is \%ENV - errlog => '/path/to/file.log', # path to where STDERR from cgi script goes - before => sub { # called before setup and script start + + # Path to where STDERR from cgi script goes + errlog => "/path/to/file.log", + + # The "before" hook is called before script start + # It receives a Mojolicious::Controller which can be modified + before => sub { my $c = shift; - # modify QUERY_STRING $c->req->url->query->param(a => 123); }, }; - app->start; + The above contains all the options you can pass on to the plugin. + + Running code refs + plugin CGI => { + route => "/some/path", + run => sub { + my $cgi = CGI->new; + # ... + } + }; + + Instead of calling a script, you can run a code block when accessing the + route. This is (pretty much) safe, even if the code block modifies + global state, since it runs in a separate fork/process. Support for semicolon in query string - plugin CGI => { support_semicolon_in_query_string => 1 }; + plugin CGI => { + support_semicolon_in_query_string => 1, + ... + }; The code above need to be added before other plugins or handler which use "url" in Mojo::Message::Request. It will inject a "before_dispatch" hook which saves the original QUERY_STRING, before it is split on "&" in Mojo::Parameters. - This is an EXPERIMENTAL feature. - ATTRIBUTES env Holds a hash ref containing the environment variables that should be @@ -56,10 +81,10 @@ In addition to "env", these dynamic variables are set: - CONTENT_LENGTH, CONTENT_TYPE, HTTP_COOKIE, HTTP_HOST, HTTP_REFERER, - HTTP_USER_AGENT, HTTPS, PATH, PATH_INFO, QUERY_STRING, REMOTE_ADDR, - REMOTE_HOST, REMOTE_PORT, REMOTE_USER, REQUEST_METHOD, SCRIPT_NAME, - SERVER_PORT, SERVER_PROTOCOL. + CONTENT_LENGTH, CONTENT_TYPE, HTTP_COOKIE, HTTP_HOST, HTTP_IF_NONE_MATCH, + HTTP_REFERER, HTTP_USER_AGENT, HTTPS, PATH, PATH_INFO, QUERY_STRING, + REMOTE_ADDR, REMOTE_HOST, REMOTE_PORT, REMOTE_USER, REQUEST_METHOD, + SCRIPT_NAME, SERVER_PORT, SERVER_PROTOCOL. Additional static variables: diff -Nru libmojolicious-plugin-cgi-perl-0.23/t/cgi-bin/not-found.pl libmojolicious-plugin-cgi-perl-0.25/t/cgi-bin/not-found.pl --- libmojolicious-plugin-cgi-perl-0.23/t/cgi-bin/not-found.pl 1970-01-01 00:00:00.000000000 +0000 +++ libmojolicious-plugin-cgi-perl-0.25/t/cgi-bin/not-found.pl 2015-11-11 21:00:21.000000000 +0000 @@ -0,0 +1,7 @@ +#!/usr/bin/env perl +use strict; +use warnings; +print "Status: 404 Not Found\r\n"; +print "Content-Type: text/html; charset=ISO-8859-1\r\n"; +print "\r\n"; +print "

This page is missing\n"; diff -Nru libmojolicious-plugin-cgi-perl-0.23/t/cgi-bin/not-modified.pl libmojolicious-plugin-cgi-perl-0.25/t/cgi-bin/not-modified.pl --- libmojolicious-plugin-cgi-perl-0.23/t/cgi-bin/not-modified.pl 1970-01-01 00:00:00.000000000 +0000 +++ libmojolicious-plugin-cgi-perl-0.25/t/cgi-bin/not-modified.pl 2015-11-11 21:00:21.000000000 +0000 @@ -0,0 +1,7 @@ +#!/usr/bin/env perl +use strict; +use warnings; + +print "Status: 304 Not Modified\r\n"; +print "X-Test: if-none-match seen: $ENV{HTTP_IF_NONE_MATCH}\r\n"; +print "\r\n"; diff -Nru libmojolicious-plugin-cgi-perl-0.23/t/cgi-bin/nph-borked.pl libmojolicious-plugin-cgi-perl-0.25/t/cgi-bin/nph-borked.pl --- libmojolicious-plugin-cgi-perl-0.23/t/cgi-bin/nph-borked.pl 1970-01-01 00:00:00.000000000 +0000 +++ libmojolicious-plugin-cgi-perl-0.25/t/cgi-bin/nph-borked.pl 2015-11-11 21:00:21.000000000 +0000 @@ -0,0 +1,10 @@ +#!/usr/bin/env perl +use strict; +use warnings; + +# When SERVER_PROTOCOL is set to "HTTP", the CGI module will just print HTTP and +# no version! +print "HTTP 403 Payment Required\r\n"; +print "Content-Type: text/html; charset=ISO-8859-1\r\n"; +print "\r\n"; +print "

This is the borked paywall.\n"; diff -Nru libmojolicious-plugin-cgi-perl-0.23/t/cgi-bin/nph.pl libmojolicious-plugin-cgi-perl-0.25/t/cgi-bin/nph.pl --- libmojolicious-plugin-cgi-perl-0.23/t/cgi-bin/nph.pl 1970-01-01 00:00:00.000000000 +0000 +++ libmojolicious-plugin-cgi-perl-0.25/t/cgi-bin/nph.pl 2015-11-11 21:00:21.000000000 +0000 @@ -0,0 +1,8 @@ +#!/usr/bin/env perl +use strict; +use warnings; + +print "HTTP/1.1 403 Payment Required\r\n"; +print "Content-Type: text/html; charset=ISO-8859-1\r\n"; +print "\r\n"; +print "

This is the paywall.\n"; diff -Nru libmojolicious-plugin-cgi-perl-0.23/t/not-found.t libmojolicious-plugin-cgi-perl-0.25/t/not-found.t --- libmojolicious-plugin-cgi-perl-0.23/t/not-found.t 1970-01-01 00:00:00.000000000 +0000 +++ libmojolicious-plugin-cgi-perl-0.25/t/not-found.t 2015-11-11 21:00:21.000000000 +0000 @@ -0,0 +1,19 @@ +use warnings; +use strict; +use Test::More; +use Test::Mojo; + +plan skip_all => 't/cgi-bin/not-found.pl' unless -x 't/cgi-bin/not-found.pl'; + +{ + use Mojolicious::Lite; + plugin CGI => [ '/not-found' => 't/cgi-bin/not-found.pl' ]; +} + +my $t = Test::Mojo->new; + +$t->get_ok('/not-found', {} ) + ->status_is(404) + ->content_like(qr'This page is missing'); + +done_testing; diff -Nru libmojolicious-plugin-cgi-perl-0.23/t/not-modified.t libmojolicious-plugin-cgi-perl-0.25/t/not-modified.t --- libmojolicious-plugin-cgi-perl-0.23/t/not-modified.t 1970-01-01 00:00:00.000000000 +0000 +++ libmojolicious-plugin-cgi-perl-0.25/t/not-modified.t 2015-11-11 21:00:21.000000000 +0000 @@ -0,0 +1,19 @@ +use warnings; +use strict; +use Test::More; +use Test::Mojo; + +plan skip_all => 't/cgi-bin/not-modified.pl' unless -x 't/cgi-bin/not-modified.pl'; + +{ + use Mojolicious::Lite; + plugin CGI => [ '/not-modified' => 't/cgi-bin/not-modified.pl' ]; +} + +my $t = Test::Mojo->new; + +$t->get_ok('/not-modified' => {'If-None-Match' => 'ABC'}) + ->status_is(304) + ->header_is('X-Test' => 'if-none-match seen: ABC'); + +done_testing; diff -Nru libmojolicious-plugin-cgi-perl-0.23/t/nph-borked.t libmojolicious-plugin-cgi-perl-0.25/t/nph-borked.t --- libmojolicious-plugin-cgi-perl-0.23/t/nph-borked.t 1970-01-01 00:00:00.000000000 +0000 +++ libmojolicious-plugin-cgi-perl-0.25/t/nph-borked.t 2015-11-11 21:00:21.000000000 +0000 @@ -0,0 +1,19 @@ +use warnings; +use strict; +use Test::More; +use Test::Mojo; + +plan skip_all => 't/cgi-bin/nph-borked.pl' unless -x 't/cgi-bin/nph-borked.pl'; + +{ + use Mojolicious::Lite; + plugin CGI => [ '/nph-borked' => 't/cgi-bin/nph-borked.pl' ]; +} + +my $t = Test::Mojo->new; + +$t->get_ok('/nph-borked', {} ) + ->status_is(403) + ->content_like(qr'This is the borked paywall'); + +done_testing; diff -Nru libmojolicious-plugin-cgi-perl-0.23/t/nph.t libmojolicious-plugin-cgi-perl-0.25/t/nph.t --- libmojolicious-plugin-cgi-perl-0.23/t/nph.t 1970-01-01 00:00:00.000000000 +0000 +++ libmojolicious-plugin-cgi-perl-0.25/t/nph.t 2015-11-11 21:00:21.000000000 +0000 @@ -0,0 +1,19 @@ +use warnings; +use strict; +use Test::More; +use Test::Mojo; + +plan skip_all => 't/cgi-bin/nph.pl' unless -x 't/cgi-bin/nph.pl'; + +{ + use Mojolicious::Lite; + plugin CGI => [ '/nph' => 't/cgi-bin/nph.pl' ]; +} + +my $t = Test::Mojo->new; + +$t->get_ok('/nph', {} ) + ->status_is(403) + ->content_like(qr'This is the paywall'); + +done_testing; diff -Nru libmojolicious-plugin-cgi-perl-0.23/t/post.t libmojolicious-plugin-cgi-perl-0.25/t/post.t --- libmojolicious-plugin-cgi-perl-0.23/t/post.t 2015-07-14 15:26:14.000000000 +0000 +++ libmojolicious-plugin-cgi-perl-0.25/t/post.t 2015-11-27 10:45:36.000000000 +0000 @@ -3,40 +3,27 @@ use Test::More; use Test::Mojo; -my @pipes = get_pipes(); - -plan skip_all => 't/cgi-bin/postman' unless -x 't/cgi-bin/postman'; +# http://cpantesters.org/cpan/report/dc79de2e-c956-11e4-9245-4861e0bfc7aa +# http://cpantesters.org/cpan/report/676eae4c-24f6-11e5-ad16-fd611bfff594 +# http://cpantesters.org/cpan/report/908763b4-24f6-11e5-8c9c-b46a1bfff594 +# http://cpantesters.org/cpan/report/1c1f3f16-8a17-11e5-b552-e159351a082c +plan skip_all => 'TEST_PIPES=1; No idea how to test this consistently' unless $ENV{TEST_PIPES}; -{ - use Mojolicious::Lite; - plugin CGI => ['/postman' => 't/cgi-bin/postman']; -} +my @pipes = get_pipes(); +my %LSOF_PIPE; # Map lsof DEVICE and NAME to same pipe. +use Mojolicious::Lite; +plugin CGI => ['/postman' => 't/cgi-bin/postman']; my $t = Test::Mojo->new; $t->post_ok('/postman', {}, "some\ndata\n")->status_is(200)->content_like(qr{^\d+\n--- some\n--- data\n$}); my $pid = $t->tx->res->body =~ /(\d+)/ ? $1 : 0; -diag $pid; - -if ($pid) { - ok !(kill 0, $pid), 'child is taken care of'; -} -else { - ok 0, 'could not get pid from cgi output'; -} - -{ - # http://cpantesters.org/cpan/report/dc79de2e-c956-11e4-9245-4861e0bfc7aa - # http://cpantesters.org/cpan/report/676eae4c-24f6-11e5-ad16-fd611bfff594 - # http://cpantesters.org/cpan/report/908763b4-24f6-11e5-8c9c-b46a1bfff594 - local $TODO = 'No idea how to test this consistently'; - is_deeply \@pipes, [get_pipes()], 'no leaky leaks'; -} +ok !(kill 0, $pid), "child $pid is taken care of ($$, @{[time]})" + or is waitpid($pid, 0), $pid, "waitpid $pid, 0 ($$, @{[time]})"; -# Map lsof DEVICE and NAME to same pipe. -my %LSOF_PIPE; +is_deeply \@pipes, [get_pipes()], 'no leaky leaks'; sub get_pipes { return diag "test for leaky pipes under Debian build", 1 if $ENV{DEBIAN_BUILD}; diff -Nru libmojolicious-plugin-cgi-perl-0.23/.travis.yml libmojolicious-plugin-cgi-perl-0.25/.travis.yml --- libmojolicious-plugin-cgi-perl-0.23/.travis.yml 2014-10-03 14:33:32.000000000 +0000 +++ libmojolicious-plugin-cgi-perl-0.25/.travis.yml 2015-11-27 10:46:15.000000000 +0000 @@ -4,9 +4,9 @@ - "5.14" - "5.10" env: - - "HARNESS_OPTIONS=j1 TEST_POD=1" + - "HARNESS_OPTIONS=j1 TEST_POD=1 TEST_MORBO=1 TEST_PIPES=1" install: - - "cpanm -n Test::Pod Test::Pod::Coverage" + - "cpanm -n Test::Pod Test::Pod::Coverage Parallel::ForkManager" - "cpanm -n --installdeps ." notifications: email: false