summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl/lib/CGI
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/tlperl/lib/CGI')
-rw-r--r--Master/tlpkg/tlperl/lib/CGI/Carp.pm69
-rw-r--r--Master/tlpkg/tlperl/lib/CGI/Cookie.pm2
-rw-r--r--Master/tlpkg/tlperl/lib/CGI/Util.pm88
3 files changed, 83 insertions, 76 deletions
diff --git a/Master/tlpkg/tlperl/lib/CGI/Carp.pm b/Master/tlpkg/tlperl/lib/CGI/Carp.pm
index 9d644d9c94c..c2145cafa42 100644
--- a/Master/tlpkg/tlperl/lib/CGI/Carp.pm
+++ b/Master/tlpkg/tlperl/lib/CGI/Carp.pm
@@ -33,9 +33,9 @@ with
use CGI::Carp
-And the standard warn(), die (), croak(), confess() and carp() calls
-will automagically be replaced with functions that write out nicely
-time-stamped messages to the HTTP server error log.
+The standard warn(), die (), croak(), confess() and carp() calls will
+be replaced with functions that write time-stamped messages to the
+HTTP server error log.
For example:
@@ -57,10 +57,10 @@ saying
use CGI::Carp qw(carpout);
-The carpout() function requires one argument, which should be a
-reference to an open filehandle for writing errors. It should be
-called in a C<BEGIN> block at the top of the CGI application so that
-compiler errors will be caught. Example:
+The carpout() function requires one argument, a reference to an open
+filehandle for writing errors. It should be called in a C<BEGIN>
+block at the top of the CGI application so that compiler errors will
+be caught. Example:
BEGIN {
use CGI::Carp qw(carpout);
@@ -69,14 +69,15 @@ compiler errors will be caught. Example:
carpout(LOG);
}
-carpout() does not handle file locking on the log for you at this point.
-Also, note that carpout() does not work with in-memory file handles, although
-a patch would be welcome to address that.
+carpout() does not handle file locking on the log for you at this
+point. Also, note that carpout() does not work with in-memory file
+handles, although a patch would be welcome to address that.
-The real STDERR is not closed -- it is moved to CGI::Carp::SAVEERR. Some
-servers, when dealing with CGI scripts, close their connection to the
-browser when the script closes STDOUT and STDERR. CGI::Carp::SAVEERR is there to
-prevent this from happening prematurely.
+The real STDERR is not closed -- it is moved to CGI::Carp::SAVEERR.
+Some servers, when dealing with CGI scripts, close their connection to
+the browser when the script closes STDOUT and STDERR.
+CGI::Carp::SAVEERR is there to prevent this from happening
+prematurely.
You can pass filehandles to carpout() in a variety of ways. The "correct"
way according to Tom Christiansen is to pass a reference to a filehandle
@@ -104,17 +105,17 @@ CGI::Carp methods is called to prevent the performance hit.
=head1 MAKING PERL ERRORS APPEAR IN THE BROWSER WINDOW
-If you want to send fatal (die, confess) errors to the browser, ask to
-import the special "fatalsToBrowser" subroutine:
+If you want to send fatal (die, confess) errors to the browser, import
+the special "fatalsToBrowser" subroutine:
use CGI::Carp qw(fatalsToBrowser);
die "Bad error here";
-Fatal errors will now be echoed to the browser as well as to the log. CGI::Carp
-arranges to send a minimal HTTP header to the browser so that even errors that
-occur in the early compile phase will be seen.
-Nonfatal errors will still be directed to the log file only (unless redirected
-with carpout).
+Fatal errors will now be echoed to the browser as well as to the log.
+CGI::Carp arranges to send a minimal HTTP header to the browser so
+that even errors that occur in the early compile phase will be seen.
+Nonfatal errors will still be directed to the log file only (unless
+redirected with carpout).
Note that fatalsToBrowser may B<not> work well with mod_perl version 2.0
and higher.
@@ -193,10 +194,10 @@ you still may get the error message printed to STDOUT.
This may have some undesireable effects when the purpose of doing the
eval is to determine which of several algorithms is to be used.
-By setting C<$CGI::Carp::TO_BROWSER> to 0 you can suppress printing the C<die> messages
-but without all of the complexity of using C<set_die_handler>.
-You can localize this effect to inside C<eval> bodies if this is desireable:
-For example:
+By setting C<$CGI::Carp::TO_BROWSER> to 0 you can suppress printing
+the C<die> messages but without all of the complexity of using
+C<set_die_handler>. You can localize this effect to inside C<eval>
+bodies if this is desireable: For example:
eval {
local $CGI::Carp::TO_BROWSER = 0;
@@ -207,12 +208,12 @@ For example:
=head1 MAKING WARNINGS APPEAR AS HTML COMMENTS
-It is now also possible to make non-fatal errors appear as HTML
-comments embedded in the output of your program. To enable this
-feature, export the new "warningsToBrowser" subroutine. Since sending
-warnings to the browser before the HTTP headers have been sent would
-cause an error, any warnings are stored in an internal buffer until
-you call the warningsToBrowser() subroutine with a true argument:
+It is also possible to make non-fatal errors appear as HTML comments
+embedded in the output of your program. To enable this feature,
+export the new "warningsToBrowser" subroutine. Since sending warnings
+to the browser before the HTTP headers have been sent would cause an
+error, any warnings are stored in an internal buffer until you call
+the warningsToBrowser() subroutine with a true argument:
use CGI::Carp qw(fatalsToBrowser warningsToBrowser);
use CGI qw(:standard);
@@ -320,12 +321,10 @@ Copyright 1995-2002, Lincoln D. Stein. All rights reserved.
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
-Address bug reports and comments to: lstein@cshl.org
-
=head1 SEE ALSO
-Carp, CGI::Base, CGI::BasePlus, CGI::Request, CGI::MiniSvr, CGI::Form,
-CGI::Response
+L<Carp>, L<CGI::Base>, L<CGI::BasePlus>, L<CGI::Request>,
+L<CGI::MiniSvr>, L<CGI::Form>, L<CGI::Response>.
=cut
diff --git a/Master/tlpkg/tlperl/lib/CGI/Cookie.pm b/Master/tlpkg/tlperl/lib/CGI/Cookie.pm
index df344ff348f..da916aca652 100644
--- a/Master/tlpkg/tlperl/lib/CGI/Cookie.pm
+++ b/Master/tlpkg/tlperl/lib/CGI/Cookie.pm
@@ -473,7 +473,7 @@ passing the request object to fetch() like this:
CGI::Cookie->fetch($r);
If the value passed to parse() is undefined, an empty array will returned in list
-contact, and an empty hashref will be returned in scalar context.
+context, and an empty hashref will be returned in scalar context.
=head2 Manipulating Cookies
diff --git a/Master/tlpkg/tlperl/lib/CGI/Util.pm b/Master/tlpkg/tlperl/lib/CGI/Util.pm
index b059281d8e5..494560e1292 100644
--- a/Master/tlpkg/tlperl/lib/CGI/Util.pm
+++ b/Master/tlpkg/tlperl/lib/CGI/Util.pm
@@ -1,15 +1,19 @@
package CGI::Util;
+use base 'Exporter';
require 5.008001;
use strict;
-require Exporter;
-our @ISA = qw(Exporter);
-our @EXPORT_OK = qw(rearrange rearrange_header make_attributes unescape escape
- expires ebcdic2ascii ascii2ebcdic);
+our @EXPORT_OK = qw(rearrange rearrange_header make_attributes unescape escape
+ expires ebcdic2ascii ascii2ebcdic);
-our $VERSION = '3.53';
+our $VERSION = '3.62';
use constant EBCDIC => "\t" ne "\011";
+# This option is not documented and may change or go away.
+# The HTML spec does not require attributes to be sorted,
+# but it's useful for testing to get a predictable order back.
+our $SORT_ATTRIBUTES;
+
# (ord('^') == 95) for codepage 1047 as on os390, vmesa
our @A2E = (
0, 1, 2, 3, 55, 45, 46, 47, 22, 5, 21, 11, 12, 13, 14, 15,
@@ -28,7 +32,7 @@ our @A2E = (
172,105,237,238,235,239,236,191,128,253,254,251,252,186,174, 89,
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
- );
+ );
our @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,
@@ -46,7 +50,7 @@ our @E2A = (
125, 74, 75, 76, 77, 78, 79, 80, 81, 82,185,251,252,249,250,255,
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 (EBCDIC && ord('^') == 106) { # as in the BS2000 posix-bc coded character set
$A2E[91] = 187; $A2E[92] = 188; $A2E[94] = 106; $A2E[96] = 74;
@@ -77,7 +81,7 @@ sub rearrange {
my ($order,@param) = @_;
my ($result, $leftover) = _rearrange_params( $order, @param );
push @$result, make_attributes( $leftover, defined $CGI::Q ? $CGI::Q->{escape} : 1 )
- if keys %$leftover;
+ if keys %$leftover;
@$result;
}
@@ -95,30 +99,30 @@ sub _rearrange_params {
return [] unless @param;
if (ref($param[0]) eq 'HASH') {
- @param = %{$param[0]};
+ @param = %{$param[0]};
} else {
- return \@param
- unless (defined($param[0]) && substr($param[0],0,1) eq '-');
+ return \@param
+ unless (defined($param[0]) && substr($param[0],0,1) eq '-');
}
# map parameters into positional indices
my ($i,%pos);
$i = 0;
foreach (@$order) {
- foreach (ref($_) eq 'ARRAY' ? @$_ : $_) { $pos{lc($_)} = $i; }
- $i++;
+ foreach (ref($_) eq 'ARRAY' ? @$_ : $_) { $pos{lc($_)} = $i; }
+ $i++;
}
my (@result,%leftover);
$#result = $#$order; # preextend
while (@param) {
- my $key = lc(shift(@param));
- $key =~ s/^\-//;
- if (exists $pos{$key}) {
- $result[$pos{$key}] = shift(@param);
- } else {
- $leftover{$key} = shift(@param);
- }
+ my $key = lc(shift(@param));
+ $key =~ s/^\-//;
+ if (exists $pos{$key}) {
+ $result[$pos{$key}] = shift(@param);
+ } else {
+ $leftover{$key} = shift(@param);
+ }
}
return \@result, \%leftover;
@@ -132,18 +136,22 @@ sub make_attributes {
my $quote = $do_not_quote ? '' : '"';
+ my @attr_keys= keys %$attr;
+ if ($SORT_ATTRIBUTES) {
+ @attr_keys= sort @attr_keys;
+ }
my(@att);
- foreach (keys %{$attr}) {
- my($key) = $_;
- $key=~s/^\-//; # get rid of initial - if present
+ foreach (@attr_keys) {
+ my($key) = $_;
+ $key=~s/^\-//; # get rid of initial - if present
- # old way: breaks EBCDIC!
- # $key=~tr/A-Z_/a-z-/; # parameters are lower case, use dashes
+ # old way: breaks EBCDIC!
+ # $key=~tr/A-Z_/a-z-/; # parameters are lower case, use dashes
- ($key="\L$key") =~ tr/_/-/; # parameters are lower case, use dashes
+ ($key="\L$key") =~ tr/_/-/; # parameters are lower case, use dashes
- my $value = $escape ? simple_escape($attr->{$_}) : $attr->{$_};
- push(@att,defined($attr->{$_}) ? qq/$key=$quote$value$quote/ : qq/$key/);
+ my $value = $escape ? simple_escape($attr->{$_}) : $attr->{$_};
+ push(@att,defined($attr->{$_}) ? qq/$key=$quote$value$quote/ : qq/$key/);
}
return @att;
}
@@ -176,19 +184,19 @@ sub unescape {
if (EBCDIC) {
$todecode =~ s/%([0-9a-fA-F]{2})/chr $A2E[hex($1)]/ge;
} else {
- # handle surrogate pairs first -- dankogai. Ref: http://unicode.org/faq/utf_bom.html#utf16-2
- $todecode =~ s{
- %u([Dd][89a-bA-B][0-9a-fA-F]{2}) # hi
- %u([Dd][c-fC-F][0-9a-fA-F]{2}) # lo
- }{
- utf8_chr(
- 0x10000
- + (hex($1) - 0xD800) * 0x400
- + (hex($2) - 0xDC00)
- )
- }gex;
+ # handle surrogate pairs first -- dankogai. Ref: http://unicode.org/faq/utf_bom.html#utf16-2
+ $todecode =~ s{
+ %u([Dd][89a-bA-B][0-9a-fA-F]{2}) # hi
+ %u([Dd][c-fC-F][0-9a-fA-F]{2}) # lo
+ }{
+ utf8_chr(
+ 0x10000
+ + (hex($1) - 0xD800) * 0x400
+ + (hex($2) - 0xDC00)
+ )
+ }gex;
$todecode =~ s/%(?:([0-9a-fA-F]{2})|u([0-9a-fA-F]{4}))/
- defined($1)? chr hex($1) : utf8_chr(hex($2))/ge;
+ defined($1)? chr hex($1) : utf8_chr(hex($2))/ge;
}
return $todecode;
}