perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Kobes <ra...@theoryx5.uwinnipeg.ca>
Subject [apache2-rename] compat test patches
Date Tue, 08 Mar 2005 18:31:51 GMT
The following diffs allow for me all the compat tests in
the apache2-rename-unstable branch to pass:
==============================================================
Index: lib/Apache2/compat.pm
===================================================================
--- lib/Apache2/compat.pm	(revision 156548)
+++ lib/Apache2/compat.pm	(working copy)
@@ -72,7 +72,7 @@
     $INC{'Apache/Table.pm'} = __FILE__;
 }

-($Apache2::Server::Starting, $Apache2::Server::ReStarting) =
+($Apache::Server::Starting, $Apache::Server::ReStarting) =
     Apache2::ServerUtil::restart_count() == 1 ? (1, 0) : (0, 1);

 # api => "overriding code"
@@ -320,6 +320,23 @@

 package Apache;

+sub unescape_url_info {
+    my($class, $string) = @_;
+    Apache2::URI::unescape_url($string);
+    $string =~ tr/+/ /;
+    $string;
+}
+
+#sorry, have to use $r->Apache2::args at the moment
+#for list context splitting
+
+sub args {
+    my $r = shift;
+    my $args = $r->args;
+    return $args unless wantarray;
+    return $r->parse_args($args);
+}
+
 sub server_root_relative {
     my $class = shift;
     if (@_ && defined($_[0]) && File::Spec->file_name_is_absolute($_[0]))
{
@@ -538,23 +555,6 @@
     } split /[=&;]/, $string, -1;
 }

-sub Apache2::unescape_url_info {
-    my($class, $string) = @_;
-    Apache2::URI::unescape_url($string);
-    $string =~ tr/+/ /;
-    $string;
-}
-
-#sorry, have to use $r->Apache2::args at the moment
-#for list context splitting
-
-sub Apache2::args {
-    my $r = shift;
-    my $args = $r->args;
-    return $args unless wantarray;
-    return $r->parse_args($args);
-}
-
 use Apache2::Const -compile => qw(MODE_READBYTES);
 use APR::Const    -compile => qw(SUCCESS BLOCK_READ);

@@ -729,7 +729,7 @@
 sub tmpfile {
     my $class = shift;
     my $limit = 100;
-    my $r = Apache2::compat::request('Apache2::File->tmpfile');
+    my $r = Apache2::compat::request('Apache::File->tmpfile');

     while ($limit--) {
         my $tmpfile = "$TMPDIR/${$}" . $TMPNAM++;
@@ -787,6 +787,8 @@

 *unescape_uri = \&Apache2::URI::unescape_url;

+*escape_path = \&Apache2::Util::escape_path;
+
 sub escape_uri {
     my $path = shift;
     my $r = Apache2::compat::request('Apache2::Util::escape_uri');
@@ -840,7 +842,7 @@
     return Apache2::DECLINED;
 }

-package Apache::Connection;
+package Apache2::Connection;

 # auth_type and user records don't exist in 2.0 conn_rec struct
 # 'PerlOptions +GlobalRequest' is required
Index: t/response/TestCompat/conn_rec.pm
===================================================================
--- t/response/TestCompat/conn_rec.pm	(revision 156535)
+++ t/response/TestCompat/conn_rec.pm	(working copy)
@@ -10,7 +10,7 @@

 use Socket qw(sockaddr_in inet_ntoa);

-use Apache2::Constants qw(OK);
+use Apache::Constants qw(OK);

 sub handler {

Index: t/response/TestCompat/apache_util.pm
===================================================================
--- t/response/TestCompat/apache_util.pm	(revision 156535)
+++ t/response/TestCompat/apache_util.pm	(working copy)
@@ -43,7 +43,7 @@
     # size_string()
     {
         while (my($k, $v) = each %string_size) {
-            ok t_cmp($v, Apache2::Util::size_string($k));
+            ok t_cmp($v, Apache::Util::size_string($k));
         }
     }

@@ -70,7 +70,7 @@
     my $html = '<p>"hi"&foo</p>';
     my $esc_html = '&lt;p&gt;&quot;hi&quot;&amp;foo&lt;/p&gt;';

-    ok t_cmp(Apache2::Util::escape_html($html), $esc_html,
+    ok t_cmp(Apache::Util::escape_html($html), $esc_html,
              "Apache2::Util::escape_html");


@@ -90,8 +90,8 @@
     if ($crypt_ok) {
         # not all platforms support C-level crypt
         my $hash = "aX9eP53k4DGfU";
-        ok t_cmp(Apache2::Util::validate_password("dougm", $hash), 1);
-        ok t_cmp(Apache2::Util::validate_password("mguod", $hash), 0);
+        ok t_cmp(Apache::Util::validate_password("dougm", $hash), 1);
+        ok t_cmp(Apache::Util::validate_password("mguod", $hash), 0);
     }

     OK;
Index: t/response/TestCompat/apache_file.pm
===================================================================
--- t/response/TestCompat/apache_file.pm	(revision 156535)
+++ t/response/TestCompat/apache_file.pm	(working copy)
@@ -1,6 +1,6 @@
 package TestCompat::apache_file;

-# Apache2::File compat layer tests
+# Apache::File compat layer tests

 # these tests are all run and validated on the server side.

@@ -23,11 +23,11 @@
     my $cfg = Apache::Test::config();
     my $vars = $cfg->{vars};

-    require Apache2::File;
+    require Apache::File;
     my $file = $vars->{t_conf_file};

     t_debug "new Apache2::File file object";
-    ok my $fh = Apache2::File->new;
+    ok my $fh = Apache::File->new;

     t_debug "open itself";
     if ($fh->open($file)) {
@@ -51,7 +51,7 @@
     ok !$fh->open("$file.nochance");

     t_debug "new+open";
-    if (my $fh = Apache2::File->new($file)) {
+    if (my $fh = Apache::File->new($file)) {
         ok 1;
         $fh->close;
     }
@@ -60,10 +60,10 @@
     }

     t_debug "new+open non-exists";
-    ok !Apache2::File->new("$file.yeahright");
+    ok !Apache::File->new("$file.yeahright");

     # tmpfile
-    my ($tmpfile, $tmpfh) = Apache2::File->tmpfile;
+    my ($tmpfile, $tmpfh) = Apache::File->tmpfile;

     t_debug "open tmpfile fh";
     ok $tmpfh;

=================================================================

-- 
best regards,
randy

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message