[libcgi-test-perl] 17/24: Changed test CGI scripts to be static, no longer generated by Makefile.PL
Axel Beckert
abe at deuxchevaux.org
Mon Jan 11 00:38:09 UTC 2016
This is an automated email from the git hooks/post-receive script.
abe pushed a commit to annotated tag 0.50
in repository libcgi-test-perl.
commit 3de91ab3348e5ec5cbe1e61d23f52372c59d03dd
Author: Alex Tokarev <nohuhu at nohuhu.org>
Date: Fri Sep 5 19:33:18 2014 -0700
Changed test CGI scripts to be static, no longer generated by Makefile.PL
Also updated Makefile.PL
---
Makefile.PL | 125 ++++++++++++-------------
t/cgi/{dumpargs.in => dumpargs} | 11 ++-
t/cgi/dumpargs.bat | 29 ++++++
t/cgi/{getform.in => getform} | 11 ++-
t/cgi/{getform.in => getform.bat} | 192 +++++++++++++++++++++-----------------
t/cgi/{printenv.in => printenv} | 7 +-
t/cgi/printenv.bat | 24 +++++
7 files changed, 243 insertions(+), 156 deletions(-)
diff --git a/Makefile.PL b/Makefile.PL
index 3d66807..d44f67d 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1,8 +1,7 @@
#
-# $Id$
-#
# Copyright (c) 2001, Raphael Manfredi
-# Copyright (c) 2011-2014 Alexander Tokarev
+# Copyright (c) 2003, Steven Hilton
+# Copyright (c) 2011-2014, Alex Tokarev
#
# You may redistribute only under the terms of the Artistic License,
# as specified in the README file that comes with the distribution.
@@ -11,79 +10,75 @@
use ExtUtils::MakeMaker;
use Config;
-# /win/ won't work since it will also match Darwin (Mac OS X)
-use constant WINDOWS => eval { $^O =~ /Win32|cygwin/ };
-
-# Munge test CGI scripts so that they run under current Perl
-my @cgi_files = do {
- my $cgi_dir = 't/cgi';
- opendir my $dh, $cgi_dir;
- map { "$cgi_dir/$_" } grep { /\.in$/ } readdir $dh;
-};
+# Add the `devtest` target to run regression and POD tests in one go
+sub MY::postamble {
+ return <<'END';
+devtest :
+ REGRESSION_TESTS=1 POD_TESTS=1 $(MAKE) test
-for my $file ( @cgi_files ) {
- my $text = do {
- open my $fin, '<', $file or die "Can't open $file for reading: $!";
- local $/ = undef;
- <$fin>;
- };
+END
+}
- if ( WINDOWS ) {
- $file =~ s{\.in}{\.bat};
- $file =~ s{/}{\\\\}g;
+# Override `disttest` so it would behave as `devtest`
+sub MY::dist_test {
+ return <<'END';
+disttest : distdir
+ cd $(DISTVNAME) && $(ABSPERLRUN) Makefile.PL
+ cd $(DISTVNAME) && $(MAKE) $(PASTHRU)
+ cd $(DISTVNAME) && $(MAKE) devtest $(PASTHRU)
- my $pl2bat = $Config{bin} . '\\pl2bat.bat';
+END
+}
- open my $fout, "| $pl2bat > $file" or die "Can't pipe to pl2bat: $!";
- print $fout $text;
- close $fout;
- }
- else {
- $text =~ s{#!PERL}{#!${^X}};
+my $MM_VERSION = $ExtUtils::MakeMaker::VERSION;
+my $github_repo = 'https://github.com/nohuhu/CGI-Test';
- $file =~ s{\.in}{};
-
- open my $fout, '>', $file or die "Can't open $file for writing: $!";
- print $fout $text;
- close $fout;
+WriteMakefile(
+ NAME => 'CGI::Test',
+ ABSTRACT => 'CGI regression test framework',
+ LICENSE => 'perl',
- chmod 0755, $file;
- };
-};
+ VERSION_FROM => 'lib/CGI/Test.pm',
+
+ PREREQ_PM => {
+ # Perl 5.20 warns that CGI is going to be removed
+ # from the core in 5.22, so we require it here
+ CGI => 0,
-WriteMakefile(
- NAME => 'CGI::Test',
- VERSION_FROM => 'lib/CGI/Test.pm',
- PREREQ_PM => {
- 'CGI' => '0',
- 'Digest::MD5' => '0',
- 'URI' => '1.10',
- ($] >= 5.008 # HTTP::Status is now in
- ? ('HTTP::Message' => '0', ) # HTTP::Message bundle which
- : ('LWP' => '0', ) # requires 5.8+
+ Storable => '1.00',
+ URI => '1.10',
+ ($] >= 5.008 # HTTP::Status is now in
+ ? ('HTTP::Message' => 0, ) # HTTP::Message bundle that
+ : ('LWP' => 0, ) # requires 5.8+
),
- 'HTML::TreeBuilder' => '0',
- 'File::Temp' => '0',
- 'File::Spec' => '0',
- 'Storable' => '1.000',
+ 'HTML::TreeBuilder' => 0,
+ 'File::Temp' => 0,
+ 'File::Spec' => 0,
},
- ABSTRACT => 'CGI regression test framework',
- AUTHOR => 'Alex Tokarev <tokarev at cpan.org>',
- LICENSE => 'perl',
+ ($MM_VERSION >= 6.57
+ ? ( AUTHOR => [
+ 'Alex Tokarev <tokarev at cpan.org>',
+ 'Steven Hilton <mshiltonj at mshiltonj.com>',
+ 'Raphael Manfredi <Raphael_Manfredi at pobox.com>',
+ ]
+ )
+ : (
+ AUTHOR => 'Alex Tokarev <tokarev at cpan.org>',
+ ),
+ ),
- META_MERGE => {
- resources => {
- bugtracker => 'http://github.com/nohuhu/CGI-Test/issues',
- repository => 'http://github.com/nohuhu/CGI-Test',
- },
- },
+ ($MM_VERSION >= 6.48 ? ( MIN_PERL_VERSION => 5.006000 ) : () ),
- clean => {
- FILES => q|
- t/cgi/dumpargs t/cgi/getform t/cgi/printenv
- t/cgi/dumpargs.bat t/cgi/getform.bat t/cgi/printenv.bat
- |,
- },
+ ($MM_VERSION >= 6.46
+ ? ( META_MERGE => {
+ resources => {
+ bugtracker => "$github_repo/issues",
+ repository => "$guthub_repo",
+ },
+ },
+ )
+ : (),
+ ),
);
diff --git a/t/cgi/dumpargs.in b/t/cgi/dumpargs
similarity index 60%
rename from t/cgi/dumpargs.in
rename to t/cgi/dumpargs
index 4790d96..21e9a12 100755
--- a/t/cgi/dumpargs.in
+++ b/t/cgi/dumpargs
@@ -1,7 +1,14 @@
-#!PERL
+#!/bin/sh
+
+exec 3<&0
+
+$PERL -x <<'END_OF_SCRIPT'
+#!perl
use CGI qw/:standard/;
+open STDIN, '<&3' or die "Can't reopen STDIN";
+
print header(-type => "text/plain");
foreach my $name (param()) {
@@ -10,3 +17,5 @@ foreach my $name (param()) {
print "$name\t at value\n";
}
+END_OF_SCRIPT
+
diff --git a/t/cgi/dumpargs.bat b/t/cgi/dumpargs.bat
new file mode 100644
index 0000000..91bcc89
--- /dev/null
+++ b/t/cgi/dumpargs.bat
@@ -0,0 +1,29 @@
+ at rem = '--*-Perl-*--
+ at echo off
+if "%OS%" == "Windows_NT" goto WinNT
+perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
+goto endofperl
+:WinNT
+perl -x -S %0 %*
+if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
+if %errorlevel% == 9009 echo You do not have Perl in your PATH.
+if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
+goto endofperl
+ at rem ';
+#!perl
+#line 15
+
+use CGI qw/:standard/;
+
+print header(-type => "text/plain");
+
+foreach my $name (param()) {
+ my @value = param($name);
+ foreach (@value) { tr/\n/ /; }
+ print "$name\t at value\n";
+}
+
+
+__END__
+:endofperl
+
diff --git a/t/cgi/getform.in b/t/cgi/getform
similarity index 93%
copy from t/cgi/getform.in
copy to t/cgi/getform
index e4cbc7b..3d34444 100755
--- a/t/cgi/getform.in
+++ b/t/cgi/getform
@@ -1,7 +1,14 @@
-#!PERL
+#!/bin/sh
+
+exec 3<&0
+
+$PERL -x <<'END_OF_SCRIPT'
+#!perl
use CGI qw/:standard/;
+open STDIN, '<&3' or die "Can't reopen STDIN";
+
$\ = "\n";
print header;
@@ -86,3 +93,5 @@ print p(
print endform;
print end_html;
+END_OF_SCRIPT
+
diff --git a/t/cgi/getform.in b/t/cgi/getform.bat
old mode 100755
new mode 100644
similarity index 76%
rename from t/cgi/getform.in
rename to t/cgi/getform.bat
index e4cbc7b..0d08f0f
--- a/t/cgi/getform.in
+++ b/t/cgi/getform.bat
@@ -1,88 +1,104 @@
-#!PERL
-
-use CGI qw/:standard/;
-
-$\ = "\n";
-
-print header;
-my $method = param("method") || request_method();
-my $action = param("action") || url();
-print start_html("$method form"), h1("$method form");
-print startform(
- -method => $method eq "POST" ? "POST" : "GET",
- -enctype => param("enctype") eq "M" ?
- "multipart/form-data" : "application/x-www-form-urlencoded",
- -action => $action,
-);
-
-my $counter = param("counter") + 1;
-param("counter", $counter);
-print hidden("counter");
-print hidden("enctype");
-
-print "Title: ", radio_group(
- -name => "title",
- -values => [qw(Mr Ms Miss)],
- -default => 'Mr'), br;
-
-print "Name: ", textfield("name"), br;
-
-print "Skills: ", checkbox_group(
- -name => "skills",
- -values => [qw(cooking drawing teaching listening)],
- -defaults => ['listening'],
-), br;
-
-print "New here: ", checkbox(
- -name => "new",
- -checked => 1,
- -value => "ON",
- -label => "click me",
-), br;
-
-
-print "Color: ", popup_menu(
- -name => "color",
- -values => [qw(white black green red blue)],
- -default => "white",
-), br;
-
-print "Note: ", textarea("note"), br;
-
-print "Prefers: ", scrolling_list(
- -name => "months",
- -values => [qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)],
- -size => 5,
- -multiple => 1,
- -default => [qw(Jul)],
-), br;
-
-print "Password: ", password_field(
- -name => "passwd",
- -size => 10,
- -maxlength => 15,
-), br;
-
-print "Portrait: ", filefield(
- -name => "portrait",
- -size => 30,
- -maxlength => 80,
-), br;
-
-print p(
- reset(),
- defaults("default"),
- submit("Send"),
- image_button(
- -name => "img_send",
- -alt => "GO!",
- -src => "go.png",
- -width => 50,
- -height => 30,
- -border => 0,
- ),
-);
-
-print endform;
-print end_html;
-
+ at rem = '--*-Perl-*--
+ at echo off
+if "%OS%" == "Windows_NT" goto WinNT
+perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
+goto endofperl
+:WinNT
+perl -x -S %0 %*
+if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
+if %errorlevel% == 9009 echo You do not have Perl in your PATH.
+if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
+goto endofperl
+ at rem ';
+#!perl
+#line 15
+
+use CGI qw/:standard/;
+
+$\ = "\n";
+
+print header;
+my $method = param("method") || request_method();
+my $action = param("action") || url();
+print start_html("$method form"), h1("$method form");
+print startform(
+ -method => $method eq "POST" ? "POST" : "GET",
+ -enctype => param("enctype") eq "M" ?
+ "multipart/form-data" : "application/x-www-form-urlencoded",
+ -action => $action,
+);
+
+my $counter = param("counter") + 1;
+param("counter", $counter);
+print hidden("counter");
+print hidden("enctype");
+
+print "Title: ", radio_group(
+ -name => "title",
+ -values => [qw(Mr Ms Miss)],
+ -default => 'Mr'), br;
+
+print "Name: ", textfield("name"), br;
+
+print "Skills: ", checkbox_group(
+ -name => "skills",
+ -values => [qw(cooking drawing teaching listening)],
+ -defaults => ['listening'],
+), br;
+
+print "New here: ", checkbox(
+ -name => "new",
+ -checked => 1,
+ -value => "ON",
+ -label => "click me",
+), br;
+
+
+print "Color: ", popup_menu(
+ -name => "color",
+ -values => [qw(white black green red blue)],
+ -default => "white",
+), br;
+
+print "Note: ", textarea("note"), br;
+
+print "Prefers: ", scrolling_list(
+ -name => "months",
+ -values => [qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)],
+ -size => 5,
+ -multiple => 1,
+ -default => [qw(Jul)],
+), br;
+
+print "Password: ", password_field(
+ -name => "passwd",
+ -size => 10,
+ -maxlength => 15,
+), br;
+
+print "Portrait: ", filefield(
+ -name => "portrait",
+ -size => 30,
+ -maxlength => 80,
+), br;
+
+print p(
+ reset(),
+ defaults("default"),
+ submit("Send"),
+ image_button(
+ -name => "img_send",
+ -alt => "GO!",
+ -src => "go.png",
+ -width => 50,
+ -height => 30,
+ -border => 0,
+ ),
+);
+
+print endform;
+print end_html;
+
+
+__END__
+:endofperl
diff --git a/t/cgi/printenv.in b/t/cgi/printenv
similarity index 63%
rename from t/cgi/printenv.in
rename to t/cgi/printenv
index 9ea1f4e..32ae15d 100755
--- a/t/cgi/printenv.in
+++ b/t/cgi/printenv
@@ -1,7 +1,12 @@
-#!PERL
+#!/bin/sh
+
+$PERL -x <<'END_OF_SCRIPT'
+#!perl
print "Content-type: text/plain\r\n\r\n";
while (($key, $val) = each %ENV) {
print "$key = $val\n";
}
+END_OF_SCRIPT
+
diff --git a/t/cgi/printenv.bat b/t/cgi/printenv.bat
new file mode 100644
index 0000000..4847e0d
--- /dev/null
+++ b/t/cgi/printenv.bat
@@ -0,0 +1,24 @@
+ at rem = '--*-Perl-*--
+ at echo off
+if "%OS%" == "Windows_NT" goto WinNT
+perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
+goto endofperl
+:WinNT
+perl -x -S %0 %*
+if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
+if %errorlevel% == 9009 echo You do not have Perl in your PATH.
+if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
+goto endofperl
+ at rem ';
+#!perl
+#line 15
+#!PERL
+
+print "Content-type: text/plain\r\n\r\n";
+while (($key, $val) = each %ENV) {
+ print "$key = $val\n";
+}
+
+
+__END__
+:endofperl
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libcgi-test-perl.git
More information about the Pkg-perl-cvs-commits
mailing list