summaryrefslogtreecommitdiff
path: root/lib/CGI
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2004-06-09 08:08:55 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2004-06-09 08:08:55 +0000
commit13548fdf3ea4357537b00f23046091deeb77bcc2 (patch)
tree9cbf7f86f5a6c1bb95ecef71a65103f70a50fbca /lib/CGI
parentdc09a129f20ae03853f77ccff57c311a4bae0f77 (diff)
downloadperl-13548fdf3ea4357537b00f23046091deeb77bcc2.tar.gz
Upgrade to CGI.pm 3.05
p4raw-id: //depot/perl@22914
Diffstat (limited to 'lib/CGI')
-rw-r--r--lib/CGI/Carp.pm13
-rw-r--r--lib/CGI/Util.pm31
-rwxr-xr-xlib/CGI/t/html.t17
3 files changed, 31 insertions, 30 deletions
diff --git a/lib/CGI/Carp.pm b/lib/CGI/Carp.pm
index 255b9e758a..e25cd7f055 100644
--- a/lib/CGI/Carp.pm
+++ b/lib/CGI/Carp.pm
@@ -281,7 +281,7 @@ use File::Spec;
$main::SIG{__WARN__}=\&CGI::Carp::warn;
-$CGI::Carp::VERSION = '1.27';
+$CGI::Carp::VERSION = '1.28';
$CGI::Carp::CUSTOM_MSG = undef;
@@ -381,10 +381,11 @@ sub ineval {
}
sub die {
- my ($arg) = @_;
- realdie @_ if ineval;
+ my ($arg,@rest) = @_;
+ realdie ($arg,@rest) if ineval();
+
if (!ref($arg)) {
- $arg = join("", @_);
+ $arg = join("", ($arg,@rest));
my($file,$line,$id) = id(1);
$arg .= " at $file line $line." unless $arg=~/\n$/;
&fatalsToBrowser($arg) if $WRAP;
@@ -443,8 +444,6 @@ END
;
my $mod_perl = exists $ENV{MOD_PERL};
- warningsToBrowser(1); # emit warnings before dying
-
if ($CUSTOM_MSG) {
if (ref($CUSTOM_MSG) eq 'CODE') {
print STDOUT "Content-type: text/html\n\n"
@@ -501,6 +500,8 @@ END
print STDOUT $mess;
}
}
+
+ warningsToBrowser(1); # emit warnings before dying
}
# Cut and paste from CGI.pm so that we don't have the overhead of
diff --git a/lib/CGI/Util.pm b/lib/CGI/Util.pm
index be104facf9..6af42de415 100644
--- a/lib/CGI/Util.pm
+++ b/lib/CGI/Util.pm
@@ -7,12 +7,11 @@ require Exporter;
@EXPORT_OK = qw(rearrange make_attributes unescape escape
expires ebcdic2ascii ascii2ebcdic);
-$VERSION = '1.4';
+$VERSION = '1.5';
$EBCDIC = "\t" ne "\011";
-if ($EBCDIC) {
- # (ord('^') == 95) for codepage 1047 as on os390, vmesa
- @A2E = (
+# (ord('^') == 95) for codepage 1047 as on os390, vmesa
+@A2E = (
0, 1, 2, 3, 55, 45, 46, 47, 22, 5, 21, 11, 12, 13, 14, 15,
16, 17, 18, 19, 60, 61, 50, 38, 24, 25, 63, 39, 28, 29, 30, 31,
64, 90,127,123, 91,108, 80,125, 77, 93, 92, 78,107, 96, 75, 97,
@@ -30,7 +29,7 @@ if ($EBCDIC) {
68, 69, 66, 70, 67, 71,156, 72, 84, 81, 82, 83, 88, 85, 86, 87,
140, 73,205,206,203,207,204,225,112,221,222,219,220,141,142,223
);
- @E2A = (
+@E2A = (
0, 1, 2, 3,156, 9,134,127,151,141,142, 11, 12, 13, 14, 15,
16, 17, 18, 19,157, 10, 8,135, 24, 25,146,143, 28, 29, 30, 31,
128,129,130,131,132,133, 23, 27,136,137,138,139,140, 5, 6, 7,
@@ -48,26 +47,26 @@ if ($EBCDIC) {
92,247, 83, 84, 85, 86, 87, 88, 89, 90,178,212,214,210,211,213,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57,179,219,220,217,218,159
);
- if (ord('^') == 106) { # as in the BS2000 posix-bc coded character set
+
+if ($EBCDIC && ord('^') == 106) { # as in the BS2000 posix-bc coded character set
$A2E[91] = 187; $A2E[92] = 188; $A2E[94] = 106; $A2E[96] = 74;
$A2E[123] = 251; $A2E[125] = 253; $A2E[126] = 255; $A2E[159] = 95;
$A2E[162] = 176; $A2E[166] = 208; $A2E[168] = 121; $A2E[172] = 186;
$A2E[175] = 161; $A2E[217] = 224; $A2E[219] = 221; $A2E[221] = 173;
$A2E[249] = 192;
-
+
$E2A[74] = 96; $E2A[95] = 159; $E2A[106] = 94; $E2A[121] = 168;
$E2A[161] = 175; $E2A[173] = 221; $E2A[176] = 162; $E2A[186] = 172;
$E2A[187] = 91; $E2A[188] = 92; $E2A[192] = 249; $E2A[208] = 166;
$E2A[221] = 219; $E2A[224] = 217; $E2A[251] = 123; $E2A[253] = 125;
$E2A[255] = 126;
- }
- elsif (ord('^') == 176) { # as in codepage 037 on os400
- $A2E[10] = 37; $A2E[91] = 186; $A2E[93] = 187; $A2E[94] = 176;
- $A2E[133] = 21; $A2E[168] = 189; $A2E[172] = 95; $A2E[221] = 173;
-
- $E2A[21] = 133; $E2A[37] = 10; $E2A[95] = 172; $E2A[173] = 221;
- $E2A[176] = 94; $E2A[186] = 91; $E2A[187] = 93; $E2A[189] = 168;
}
+elsif ($EBCDIC && ord('^') == 176) { # as in codepage 037 on os400
+ $A2E[10] = 37; $A2E[91] = 186; $A2E[93] = 187; $A2E[94] = 176;
+ $A2E[133] = 21; $A2E[168] = 189; $A2E[172] = 95; $A2E[221] = 173;
+
+ $E2A[21] = 133; $E2A[37] = 10; $E2A[95] = 172; $E2A[173] = 221;
+ $E2A[176] = 94; $E2A[186] = 91; $E2A[187] = 93; $E2A[189] = 168;
}
# Smart rearrangement of parameters to allow named parameter
@@ -140,7 +139,7 @@ sub simple_escape {
$toencode;
}
-sub utf8_chr ($) {
+sub utf8_chr {
my $c = shift(@_);
if ($c < 0x80) {
@@ -175,7 +174,7 @@ sub utf8_chr ($) {
0x80 | (($c >> 6) & 0x3f),
0x80 | ( $c & 0x3f));
} else {
- return utf8(0xfffd);
+ return utf8_chr(0xfffd);
}
}
diff --git a/lib/CGI/t/html.t b/lib/CGI/t/html.t
index b3c462c079..dbab2fcdfd 100755
--- a/lib/CGI/t/html.t
+++ b/lib/CGI/t/html.t
@@ -62,14 +62,7 @@ test(13,start_html() ."\n" eq <<END,"start_html()");
</head><body>
END
;
-test(14,start_html(-dtd=>"-//IETF//DTD HTML 3.2//FR",-lang=>'fr') ."\n" eq <<END,"start_html()");
-<!DOCTYPE html
- PUBLIC "-//IETF//DTD HTML 3.2//FR">
-<html xmlns="http://www.w3.org/1999/xhtml" lang="fr" xml:lang="fr"><head><title>Untitled Document</title>
-</head><body>
-END
- ;
-test(15,start_html(-Title=>'The world of foo') ."\n" eq <<END,"start_html()");
+test(14,start_html(-Title=>'The world of foo') ."\n" eq <<END,"start_html()");
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
@@ -78,6 +71,14 @@ test(15,start_html(-Title=>'The world of foo') ."\n" eq <<END,"start_html()");
</head><body>
END
;
+# Note that this test will turn off XHTML until we make a new CGI object.
+test(15,start_html(-dtd=>"-//IETF//DTD HTML 3.2//FR",-lang=>'fr') ."\n" eq <<END,"start_html()");
+<!DOCTYPE html
+ PUBLIC "-//IETF//DTD HTML 3.2//FR">
+<html lang="fr"><head><title>Untitled Document</title>
+</head><body>
+END
+ ;
test(16,($cookie=cookie(-name=>'fred',-value=>['chocolate','chip'],-path=>'/')) eq 'fred=chocolate&chip; path=/',"cookie()");
my $h = header(-Cookie=>$cookie);
test(17,$h =~ m!^Set-Cookie: fred=chocolate&chip\; path=/${CRLF}Date:.*${CRLF}Content-Type: text/html; charset=ISO-8859-1${CRLF}${CRLF}!s,