summaryrefslogtreecommitdiff
path: root/lib/CGI
diff options
context:
space:
mode:
authorSteve Peters <steve@fisharerojo.org>2005-12-05 16:20:17 +0000
committerSteve Peters <steve@fisharerojo.org>2005-12-05 16:20:17 +0000
commit0a9bdad46b06555ba154417c5a8961c69cfa8b21 (patch)
tree37474d36d1681b5cf50edd547a1ec292e25a68a0 /lib/CGI
parent987b48f09f72784df60731e511fd601dd9755112 (diff)
downloadperl-0a9bdad46b06555ba154417c5a8961c69cfa8b21.tar.gz
Upgrade to CGI.pm-3.13
p4raw-id: //depot/perl@26260
Diffstat (limited to 'lib/CGI')
-rw-r--r--lib/CGI/Carp.pm2
-rw-r--r--lib/CGI/Changes20
-rw-r--r--lib/CGI/Cookie.pm2
-rwxr-xr-xlib/CGI/t/form.t4
-rw-r--r--lib/CGI/t/no_tabindex.t126
5 files changed, 150 insertions, 4 deletions
diff --git a/lib/CGI/Carp.pm b/lib/CGI/Carp.pm
index bb4b2c789e..2d1daad2fa 100644
--- a/lib/CGI/Carp.pm
+++ b/lib/CGI/Carp.pm
@@ -466,7 +466,7 @@ END
if ($mod_perl) {
my $r;
- if ($ENV{MOD_PERL_API_VERSION}) {
+ if ($ENV{MOD_PERL_API_VERSION} && $ENV{MOD_PERL_API_VERSION} == 2) {
$mod_perl = 2;
require Apache2::RequestRec;
require Apache2::RequestIO;
diff --git a/lib/CGI/Changes b/lib/CGI/Changes
index e4699338c0..b4b46198b5 100644
--- a/lib/CGI/Changes
+++ b/lib/CGI/Changes
@@ -1,3 +1,23 @@
+ Version 3.13
+ 1. Removed extraneous empty "?" from end of self_url().
+
+ Version 3.12
+ 1. Fixed virtual_port so that it works properly with https protocol.
+ 2. Fixed documentation for upload_hook().
+ 3. Added POSTDATA documentation.
+ 4. Made upload_hook() work in function-oriented mode.
+ 5. Fixed POST_MAX behavior so that it doesn't cause client to hang.
+ 6. Disabled automatic tab indexes and added new -tabindex pragma to
+ turn automatic indexes back on.
+ 7. The url() and self_url() methods now work better in the context of Apache
+ mod_rewrite. Be advised that path_info() may give you confusing results
+ when mod_rewrite is active because Apache calculates the path info *after*
+ rewriting. This is mostly worked around in url() and self_url(), but you
+ may notice some anomalies.
+ 8. Removed empty (and non-validating) <div> from code emitted by end_form().
+ 9. Fixed CGI::Carp to work correctly with Mod_perl 1.29 in an Apache 2 environment.
+ 10. Setting $CGI::TMPDIRECTORY should now be effective.
+
Version 3.11
1. Killed warning in CGI::Cookie about MOD_PERL_API_VERSION
2. Fixed append() so that it works in function mode.
diff --git a/lib/CGI/Cookie.pm b/lib/CGI/Cookie.pm
index 0b915f0aad..789aa25d1a 100644
--- a/lib/CGI/Cookie.pm
+++ b/lib/CGI/Cookie.pm
@@ -159,7 +159,7 @@ sub as_string {
push(@constant_values,"secure") if $secure = $self->secure;
my($key) = escape($self->name);
- my($cookie) = join("=",$key,join("&",map escape($_),$self->value));
+ my($cookie) = join("=",($key||''),join("&",map escape($_||''),$self->value));
return join("; ",$cookie,@constant_values);
}
diff --git a/lib/CGI/t/form.t b/lib/CGI/t/form.t
index dd8338c596..558dce9037 100755
--- a/lib/CGI/t/form.t
+++ b/lib/CGI/t/form.t
@@ -7,7 +7,7 @@ use lib qw(. ./blib/lib ./blib/arch);
use Test::More tests => 17;
BEGIN { use_ok('CGI'); };
-use CGI (':standard','-no_debug');
+use CGI (':standard','-no_debug','-tabindex');
my $CRLF = "\015\012";
if ($^O eq 'VMS') {
@@ -111,7 +111,7 @@ is(popup_menu(-name => 'game',
'-values' => [qw/checkers chess cribbage/],
-default => 'cribbage',
-override => 1),
- '<select name="game" tabindex="21">
+ '<select name="game" tabindex="21" >
<option value="checkers">checkers</option>
<option value="chess">chess</option>
<option selected="selected" value="cribbage">cribbage</option>
diff --git a/lib/CGI/t/no_tabindex.t b/lib/CGI/t/no_tabindex.t
new file mode 100644
index 0000000000..c9a7fb8fb6
--- /dev/null
+++ b/lib/CGI/t/no_tabindex.t
@@ -0,0 +1,126 @@
+#!/usr/local/bin/perl -w
+
+# Due to a bug in older versions of MakeMaker & Test::Harness, we must
+# ensure the blib's are in @INC, else we might use the core CGI.pm
+use lib qw(. ./blib/lib ./blib/arch);
+
+use Test::More tests => 18;
+
+BEGIN { use_ok('CGI'); };
+use CGI (':standard','-no_debug');
+
+my $CRLF = "\015\012";
+if ($^O eq 'VMS') {
+ $CRLF = "\n"; # via web server carriage is inserted automatically
+}
+if (ord("\t") != 9) { # EBCDIC?
+ $CRLF = "\r\n";
+}
+
+
+# Set up a CGI environment
+$ENV{REQUEST_METHOD} = 'GET';
+$ENV{QUERY_STRING} = 'game=chess&game=checkers&weather=dull';
+$ENV{PATH_INFO} = '/somewhere/else';
+$ENV{PATH_TRANSLATED} = '/usr/local/somewhere/else';
+$ENV{SCRIPT_NAME} ='/cgi-bin/foo.cgi';
+$ENV{SERVER_PROTOCOL} = 'HTTP/1.0';
+$ENV{SERVER_PORT} = 8080;
+$ENV{SERVER_NAME} = 'the.good.ship.lollypop.com';
+
+ok( (not $CGI::TABINDEX), "Tab index turned off.");
+
+is(submit(),
+ qq(<input type="submit" name=".submit" />),
+ "submit()");
+
+is(submit(-name => 'foo',
+ -value => 'bar'),
+ qq(<input type="submit" name="foo" value="bar" />),
+ "submit(-name,-value)");
+
+is(submit({-name => 'foo',
+ -value => 'bar'}),
+ qq(<input type="submit" name="foo" value="bar" />),
+ "submit({-name,-value})");
+
+is(textfield(-name => 'weather'),
+ qq(<input type="text" name="weather" value="dull" />),
+ "textfield({-name})");
+
+is(textfield(-name => 'weather',
+ -value => 'nice'),
+ qq(<input type="text" name="weather" value="dull" />),
+ "textfield({-name,-value})");
+
+is(textfield(-name => 'weather',
+ -value => 'nice',
+ -override => 1),
+ qq(<input type="text" name="weather" value="nice" />),
+ "textfield({-name,-value,-override})");
+
+is(checkbox(-name => 'weather',
+ -value => 'nice'),
+ qq(<label><input type="checkbox" name="weather" value="nice" />weather</label>),
+ "checkbox()");
+
+is(checkbox(-name => 'weather',
+ -value => 'nice',
+ -label => 'forecast'),
+ qq(<label><input type="checkbox" name="weather" value="nice" />forecast</label>),
+ "checkbox()");
+
+is(checkbox(-name => 'weather',
+ -value => 'nice',
+ -label => 'forecast',
+ -checked => 1,
+ -override => 1),
+ qq(<label><input type="checkbox" name="weather" value="nice" checked="checked" />forecast</label>),
+ "checkbox()");
+
+is(checkbox(-name => 'weather',
+ -value => 'dull',
+ -label => 'forecast'),
+ qq(<label><input type="checkbox" name="weather" value="dull" checked="checked" />forecast</label>),
+ "checkbox()");
+
+is(radio_group(-name => 'game'),
+ qq(<label><input type="radio" name="game" value="chess" checked="checked" />chess</label> <label><input type="radio" name="game" value="checkers" />checkers</label>),
+ 'radio_group()');
+
+is(radio_group(-name => 'game',
+ -labels => {'chess' => 'ping pong'}),
+ qq(<label><input type="radio" name="game" value="chess" checked="checked" />ping pong</label> <label><input type="radio" name="game" value="checkers" />checkers</label>),
+ 'radio_group()');
+
+is(checkbox_group(-name => 'game',
+ -Values => [qw/checkers chess cribbage/]),
+ qq(<label><input type="checkbox" name="game" value="checkers" checked="checked" />checkers</label> <label><input type="checkbox" name="game" value="chess" checked="checked" />chess</label> <label><input type="checkbox" name="game" value="cribbage" />cribbage</label>),
+ 'checkbox_group()');
+
+is(checkbox_group(-name => 'game',
+ '-values' => [qw/checkers chess cribbage/],
+ '-defaults' => ['cribbage'],
+ -override=>1),
+ qq(<label><input type="checkbox" name="game" value="checkers" />checkers</label> <label><input type="checkbox" name="game" value="chess" />chess</label> <label><input type="checkbox" name="game" value="cribbage" checked="checked" />cribbage</label>),
+ 'checkbox_group()');
+
+is(popup_menu(-name => 'game',
+ '-values' => [qw/checkers chess cribbage/],
+ -default => 'cribbage',
+ -override => 1),
+ '<select name="game" >
+<option value="checkers">checkers</option>
+<option value="chess">chess</option>
+<option selected="selected" value="cribbage">cribbage</option>
+</select>',
+ 'popup_menu()');
+
+
+is(textarea(-name=>'foo',
+ -default=>'starting value',
+ -rows=>10,
+ -columns=>50),
+ '<textarea name="foo" rows="10" cols="50">starting value</textarea>',
+ 'textarea()');
+