Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

version 2.80

  • Loading branch information...
commit 19df2b90ad5faf96a0bf7eeb778ddee00f5267f1 1 parent 3b3cc03
lstein authored
Showing with 46 additions and 45 deletions.
  1. +24 −29 CGI.pm
  2. +4 −4 CGI/Carp.pm
  3. +8 −2 cgi_docs.html
  4. +10 −10 t/form.t
View
53 CGI.pm
@@ -18,8 +18,8 @@ use Carp 'croak';
# The most recent version and complete docs are available at:
# http://stein.cshl.org/WWW/software/CGI/
-$CGI::revision = '$Id: CGI.pm,v 1.57 2002-01-12 02:19:25 lstein Exp $';
-$CGI::VERSION='2.79';
+$CGI::revision = '$Id: CGI.pm,v 1.58 2002-01-12 02:44:56 lstein Exp $';
+$CGI::VERSION='2.80';
# HARD-CODED LOCATION FOR FILE UPLOAD TEMPORARY FILES.
# UNCOMMENT THIS ONLY IF YOU KNOW WHAT YOU'RE DOING.
@@ -36,7 +36,7 @@ use constant XHTML_DTD => ['-//W3C//DTD XHTML 1.0 Transitional//EN',
sub initialize_globals {
# Set this to 1 to enable copious autoloader debugging messages
$AUTOLOAD_DEBUG = 0;
-
+
# Set this to 1 to generate XTML-compatible output
$XHTML = 1;
@@ -85,9 +85,9 @@ sub initialize_globals {
# separate the name=value pairs by semicolons rather than ampersands
$USE_PARAM_SEMICOLONS = 1;
- # Do not include undefined params parsed from query string
- # use CGI qw(-no_undef_params);
- $NO_UNDEF_PARAMS = 0;
+ # Do not include undefined params parsed from query string
+ # use CGI qw(-no_undef_params);
+ $NO_UNDEF_PARAMS = 0;
# Other globals that you shouldn't worry about.
undef $Q;
@@ -2287,25 +2287,22 @@ sub url {
my ($relative,$absolute,$full,$path_info,$query,$base) =
rearrange(['RELATIVE','ABSOLUTE','FULL',['PATH','PATH_INFO'],['QUERY','QUERY_STRING'],'BASE'],@p);
my $url;
- $full++ if $base || !($relative || $absolute);
+ $full++ if $base || !($relative || $absolute);
my $path = $self->path_info;
my $script_name = $self->script_name;
-# If anybody knows why I ever wrote this please tell me!
-# if (exists($ENV{REQUEST_URI})) {
-# my $index;
-# $script_name = $ENV{REQUEST_URI};
-# # strip query string
-# substr($script_name,$index) = '' if ($index = index($script_name,'?')) >= 0;
-# # and path
-# if (exists($ENV{PATH_INFO})) {
-# (my $encoded_path = $ENV{PATH_INFO}) =~ s!([^a-zA-Z0-9_./-])!uc sprintf("%%%02x",ord($1))!eg;;
-# substr($script_name,$index) = '' if ($index = rindex($script_name,$encoded_path)) >= 0;
-# }
-# } else {
-# $script_name = $self->script_name;
-# }
+ # for compatibility with Apache's MultiViews
+ if (exists($ENV{REQUEST_URI})) {
+ my $index;
+ $script_name = $ENV{REQUEST_URI};
+ $script_name =~ s/\?.+$//; # strip query string
+ # and path
+ if (exists($ENV{PATH_INFO})) {
+ (my $encoded_path = $ENV{PATH_INFO}) =~ s/([^a-zA-Z0-9_.%;&?\/\\:+=~-])/sprintf("%%%02X",ord($1))/eg;
+ $script_name =~ s/$encoded_path$//i;
+ }
+ }
if ($full) {
my $protocol = $self->protocol();
@@ -2331,7 +2328,7 @@ sub url {
$url .= $path if $path_info and defined $path;
$url .= "?" . $self->query_string if $query and $self->query_string;
$url = '' unless defined $url;
- $url =~ s/([^a-zA-Z0-9_.%;&?\/\\:+=~-])/uc sprintf("%%%02x",ord($1))/eg;
+ $url =~ s/([^a-zA-Z0-9_.%;&?\/\\:+=~-])/sprintf("%%%02X",ord($1))/eg;
return $url;
}
@@ -3366,6 +3363,11 @@ $MAXTRIES = 5000;
# %OVERLOAD = ('""'=>'as_string');
*CGITempFile::AUTOLOAD = \&CGI::AUTOLOAD;
+sub DESTROY {
+ my($self) = @_;
+ unlink $$self; # get rid of the file
+}
+
###############################################################################
################# THESE FUNCTIONS ARE AUTOLOADED ON DEMAND ####################
###############################################################################
@@ -3387,13 +3389,6 @@ sub new {
}
END_OF_FUNC
-'DESTROY' => <<'END_OF_FUNC',
-sub DESTROY {
- my($self) = @_;
- unlink $$self; # get rid of the file
-}
-END_OF_FUNC
-
'as_string' => <<'END_OF_FUNC'
sub as_string {
my($self) = @_;
View
8 CGI/Carp.pm
@@ -318,10 +318,10 @@ sub set_message {
return $CGI::Carp::CUSTOM_MSG;
}
-sub confess { CGI::Carp::die Carp::longmess \@_; }
-sub croak { CGI::Carp::die Carp::shortmess \@_; }
-sub carp { CGI::Carp::warn Carp::shortmess \@_; }
-sub cluck { CGI::Carp::warn Carp::longmess \@_; }
+sub confess { CGI::Carp::die Carp::longmess @_; }
+sub croak { CGI::Carp::die Carp::shortmess @_; }
+sub carp { CGI::Carp::warn Carp::shortmess @_; }
+sub cluck { CGI::Carp::warn Carp::longmess @_; }
# We have to be ready to accept a filehandle as a reference
# or a string.
View
10 cgi_docs.html
@@ -7,7 +7,7 @@
<BODY bgcolor="#FFFFFF">
<H1><IMG SRC="examples/dna.small.gif" ALT="[logo]">
CGI.pm - a Perl5 CGI Library</H1>
-Version 2.79, 12/9/2001, L. Stein
+Version 2.80, 1/11/2002, L. Stein
<p>
<H2>Abstract</H2> This perl 5 library uses objects to create Web
@@ -4688,6 +4688,12 @@
<HR>
<H2><A NAME="new">Revision History</A></H2>
+<h3>Version 2.80</h3>
+<ol>
+ <li>Fixed broken messages in CGI::Carp.
+ <li>Changed checked="1" to checked="checked" for real XHTML compatibility.
+ <li>Resurrected REQUEST_URI code so that url() works correctly with multiviews.
+</ol>
<h3>Version 2.79</h3>
<ol>
<li>Changes to CGI::Carp to avoid "subroutine redefined" error messages.
@@ -5630,6 +5636,6 @@
<a href="http://www.cshl.org/">Cold Spring Harbor Laboratory</a></ADDRESS>
<P>
<!-- hhmts start -->
-Last modified: Sun Dec 9 16:35:43 EST 2001
+Last modified: Fri Jan 11 21:44:27 EST 2002
<!-- hhmts end -->
</BODY> </HTML>
View
20 t/form.t
@@ -79,30 +79,30 @@ is(checkbox(-name => 'weather',
-label => 'forecast',
-checked => 1,
-override => 1),
- qq(<input type="checkbox" name="weather" value="nice" checked="1" />forecast),
+ qq(<input type="checkbox" name="weather" value="nice" checked="checked" />forecast),
"checkbox()");
is(checkbox(-name => 'weather',
-value => 'dull',
-label => 'forecast'),
- qq(<input type="checkbox" name="weather" value="dull" checked="1" />forecast),
+ qq(<input type="checkbox" name="weather" value="dull" checked="checked" />forecast),
"checkbox()");
is(radio_group(-name => 'game'),
- qq(<input type="radio" name="game" value="chess" checked="1" />chess ).
+ qq(<input type="radio" name="game" value="chess" checked="checked" />chess ).
qq(<input type="radio" name="game" value="checkers" />checkers),
'radio_group()');
is(radio_group(-name => 'game',
-labels => {'chess' => 'ping pong'}),
- qq(<input type="radio" name="game" value="chess" checked="1" />ping pong ).
+ qq(<input type="radio" name="game" value="chess" checked="checked" />ping pong ).
qq(<input type="radio" name="game" value="checkers" />checkers),
'radio_group()');
is(checkbox_group(-name => 'game',
-Values => [qw/checkers chess cribbage/]),
- qq(<input type="checkbox" name="game" value="checkers" checked="1" />checkers ).
- qq(<input type="checkbox" name="game" value="chess" checked="1" />chess ).
+ qq(<input type="checkbox" name="game" value="checkers" checked="checked" />checkers ).
+ qq(<input type="checkbox" name="game" value="chess" checked="checked" />chess ).
qq(<input type="checkbox" name="game" value="cribbage" />cribbage),
'checkbox_group()');
@@ -111,7 +111,7 @@ is(checkbox_group(-name => 'game',
'-defaults' => ['cribbage'],-override=>1),
qq(<input type="checkbox" name="game" value="checkers" />checkers ).
qq(<input type="checkbox" name="game" value="chess" />chess ).
- qq(<input type="checkbox" name="game" value="cribbage" checked="1" />cribbage),
+ qq(<input type="checkbox" name="game" value="cribbage" checked="checked" />cribbage),
'checkbox_group()');
is(popup_menu(-name => 'game',
@@ -120,9 +120,9 @@ is(popup_menu(-name => 'game',
-override => 1)."\n",
<<END, 'checkbox_group()');
<select name="game">
-<option value="checkers">checkers</option>
-<option value="chess">chess</option>
-<option selected="1" value="cribbage">cribbage</option>
+<option value="checkers">checkers</option>
+<option value="chess">chess</option>
+<option selected="selected" value="cribbage">cribbage</option>
</select>
END
Please sign in to comment.
Something went wrong with that request. Please try again.