[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bricolage-commits
Subject:    [6630] Initial stab at replacing mod_perl1 modules with mod_perl2
From:       steven.pritchard () bricolage ! cc
Date:       2005-08-31 21:31:29
Message-ID: 20050831213129.16076.qmail () x1 ! develooper ! com
[Download RAW message or body]

Revision: 6630
Author:   steven.pritchard
Date:     2005-08-31 14:31:28 -0700 (Wed, 31 Aug 2005)
ViewCVS:  http://viewsvn.bricolage.cc/?rev=6630&view=rev

Log Message:
-----------
Initial stab at replacing mod_perl1 modules with mod_perl2 equivalents.

Modified Paths:
--------------
    bricolage/branches/dev_apache2/comp/errors/403.mc
    bricolage/branches/dev_apache2/comp/errors/404.mc
    bricolage/branches/dev_apache2/comp/errors/500.mc
    bricolage/branches/dev_apache2/inst/required.pl
    bricolage/branches/dev_apache2/lib/Bric/Admin.pod
    bricolage/branches/dev_apache2/lib/Bric/App/AccessHandler.pm
    bricolage/branches/dev_apache2/lib/Bric/App/ApacheConfig.pm
    bricolage/branches/dev_apache2/lib/Bric/App/ApacheStartup.pm
    bricolage/branches/dev_apache2/lib/Bric/App/Auth.pm
    bricolage/branches/dev_apache2/lib/Bric/App/Authz.pm
    bricolage/branches/dev_apache2/lib/Bric/App/Callback/Profile/Contrib.pm
    bricolage/branches/dev_apache2/lib/Bric/App/Callback/Search.pm
    bricolage/branches/dev_apache2/lib/Bric/App/CleanupHandler.pm
    bricolage/branches/dev_apache2/lib/Bric/App/Handler.pm
    bricolage/branches/dev_apache2/lib/Bric/App/PreviewHandler.pm
    bricolage/branches/dev_apache2/lib/Bric/App/Session.pm
    bricolage/branches/dev_apache2/lib/Bric/App/Util.pm
    bricolage/branches/dev_apache2/lib/Bric/Dist/Handler.pm
    bricolage/branches/dev_apache2/lib/Bric/SOAP/Auth.pm
    bricolage/branches/dev_apache2/lib/Bric/SOAP/Element.pm
    bricolage/branches/dev_apache2/lib/Bric/SOAP/Handler.pm
    bricolage/branches/dev_apache2/lib/Bric/Util/Trans/FS.pm
    bricolage/branches/dev_apache2/lib/Bric.pm
    bricolage/branches/dev_apache2/t/Bric/App/Session/Test.pm



["r6630-steven.pritchard.diff" (r6630-steven.pritchard.diff)]

Modified: bricolage/branches/dev_apache2/comp/errors/403.mc
===================================================================
--- bricolage/branches/dev_apache2/comp/errors/403.mc	2005-08-31 21:20:52 UTC (rev \
                6629)
+++ bricolage/branches/dev_apache2/comp/errors/403.mc	2005-08-31 21:31:28 UTC (rev \
6630) @@ -32,7 +32,7 @@
         "</p>\n");
 $m->comp('/widgets/wrappers/sharky/footer.mc');
 $m->flush_buffer;
-$r->status(Apache::Constants::HTTP_FORBIDDEN);
+$r->status(Apache2::Const::HTTP_FORBIDDEN);
 $m->abort;
 </%perl>
 <%args>

Modified: bricolage/branches/dev_apache2/comp/errors/404.mc
===================================================================
--- bricolage/branches/dev_apache2/comp/errors/404.mc	2005-08-31 21:20:52 UTC (rev \
                6629)
+++ bricolage/branches/dev_apache2/comp/errors/404.mc	2005-08-31 21:31:28 UTC (rev \
6630) @@ -16,5 +16,5 @@
 <p><% $lang->maketext('Please check the URL and try again. If you feel you have \
reached this page as a result of a server error or other bug, please notify the \
server administrator. Be sure to include as much detail as possible, including the \
type of browser, operating system, and the steps leading up to your arrival \
here.')%></p>  
 <& '/widgets/wrappers/sharky/footer.mc', param => \%ARGS &>
-% $r->status(Apache::Constants::HTTP_NOT_FOUND);
+% $r->status(Apache2::Const::HTTP_NOT_FOUND);
 % $m->abort;

Modified: bricolage/branches/dev_apache2/comp/errors/500.mc
===================================================================
--- bricolage/branches/dev_apache2/comp/errors/500.mc	2005-08-31 21:20:52 UTC (rev \
                6629)
+++ bricolage/branches/dev_apache2/comp/errors/500.mc	2005-08-31 21:31:28 UTC (rev \
6630) @@ -85,7 +85,7 @@
 % }
 
 <& '/widgets/wrappers/sharky/footer.mc' &>
-% $r->status(Apache::Constants::HTTP_INTERNAL_SERVER_ERROR);
+% $r->status(Apache2::Const::HTTP_INTERNAL_SERVER_ERROR);
 % $m->abort;
 <%init>;
 # Clear out messages - they're likely irrelevant now.

Modified: bricolage/branches/dev_apache2/inst/required.pl
===================================================================
--- bricolage/branches/dev_apache2/inst/required.pl	2005-08-31 21:20:52 UTC (rev \
                6629)
+++ bricolage/branches/dev_apache2/inst/required.pl	2005-08-31 21:31:28 UTC (rev \
6630) @@ -207,11 +207,11 @@
     return soft_fail("Failed to parse Apache version from string ",
                      "\"$version\".") 
         unless defined $x and defined $y and defined $z;
-    return soft_fail("Found Apache 2. Bricolage only supports Apache 1.3.\n")
-      if $x > 1;
+    #return soft_fail("Found Apache 2. Bricolage only supports Apache 1.3.\n")
+    #  if $x > 1;
     return soft_fail("Found old version of Apache: $x.$y.$z - ",
                      "1.3.12 or greater required.")
-        unless (($x == 1 and $y > 3) or ($x == 1 and $y == 3 and $z >= 12));
+        unless ($x==2 or ($x == 1 and $y > 3) or ($x == 1 and $y == 3 and $z >= \
12));  print "Found acceptable version of Apache: $x.$y.$z.\n";
     $REQ{APACHE_VERSION} = [$x,$y,$z];
 

Modified: bricolage/branches/dev_apache2/lib/Bric/Admin.pod
===================================================================
--- bricolage/branches/dev_apache2/lib/Bric/Admin.pod	2005-08-31 21:20:52 UTC (rev \
                6629)
+++ bricolage/branches/dev_apache2/lib/Bric/Admin.pod	2005-08-31 21:31:28 UTC (rev \
6630) @@ -145,7 +145,7 @@
 
 =item Class::Container 0.09
 
-=item Apache::Request 1.0
+=item Apache2::Request 2.0
 
 =item HTML::Mason 1.23
 

Modified: bricolage/branches/dev_apache2/lib/Bric/App/AccessHandler.pm
===================================================================
--- bricolage/branches/dev_apache2/lib/Bric/App/AccessHandler.pm	2005-08-31 21:20:52 \
                UTC (rev 6629)
+++ bricolage/branches/dev_apache2/lib/Bric/App/AccessHandler.pm	2005-08-31 21:31:28 \
UTC (rev 6630) @@ -54,8 +54,8 @@
 
 ################################################################################
 # Programmatic Dependencies
-use Apache::Constants qw(:common :http);
-use Apache::Log;
+use Apache2::Const qw(:common :http);
+use Apache2::Log;
 use Bric::App::Session;
 use Bric::App::Util qw(:redir :history);
 use Bric::App::Auth qw(auth logout);
@@ -138,13 +138,13 @@
 
         # Propagate SESSION and AUTH cookies if we switched server ports
         my %qs = $r->args;
-        my %cookies = Apache::Cookie->fetch;
+        my %cookies = Apache2::Cookie->fetch;
         # work around multiple servers if login event
         if ( exists $qs{&AUTH_COOKIE} && ! $cookies{&AUTH_COOKIE} ) {
             foreach(&COOKIE, &AUTH_COOKIE) {
                 if (exists $qs{$_} && $qs{$_}) {
                     # hmmm.... Apache is in @INC or we would not have $r
-                    my $cook = Apache::unescape_url($qs{$_});
+                    my $cook = CGI::Util::unescape($qs{$_});
                     $cookies{$_} = $cook;           # insert / overwrite value
                     # propagate this particular cookie back to the browser with
                     # all properties

Modified: bricolage/branches/dev_apache2/lib/Bric/App/ApacheConfig.pm
===================================================================
--- bricolage/branches/dev_apache2/lib/Bric/App/ApacheConfig.pm	2005-08-31 21:20:52 \
                UTC (rev 6629)
+++ bricolage/branches/dev_apache2/lib/Bric/App/ApacheConfig.pm	2005-08-31 21:31:28 \
UTC (rev 6630) @@ -128,7 +128,7 @@
     # after login goes to the debugger's STDOUT instead of the
     # browser!
     my $fix = DEBUGGING
-      ? "\n    PerlFixupHandler    Apache::OK"
+      ? "\n    PerlFixupHandler    Apache2::Const::OK"
       : '';
 
     # This URI will handle logging users in.
@@ -147,8 +147,8 @@
     push @locs,
       "  <Location /media>\n" .
       "    SetHandler          default-handler\n" .
-      "    PerlAccessHandler   Apache::OK\n" .
-      "    PerlCleanupHandler  Apache::OK$fix\n" .
+      "    PerlAccessHandler   Apache2::Const::OK\n" .
+      "    PerlCleanupHandler  Apache2::Const::OK$fix\n" .
       "  </Location>";
 
     # Force JavaScript to the proper MIME type and always use Unicode.
@@ -169,13 +169,13 @@
           "  <Location /media/wysiwyg/htmlarea/plugins/SpellChecker>\n" .
           "    SetHandler None\n" .
           "    AddHandler perl-script .cgi\n" .
-          "    PerlHandler Apache::Registry\n" .
+          "    PerlHandler ModPerl::Registry\n" .
           "  </Location>";
         push @locs,
           "  <Location /media/wysiwyg/xinha/plugins/SpellChecker>\n" .
           "    SetHandler None\n" .
           "    AddHandler perl-script .cgi\n" .
-          "    PerlHandler Apache::Registry\n" .
+          "    PerlHandler ModPerl::Registry\n" .
           "  </Location>";
     }
 
@@ -190,7 +190,7 @@
       "  <Location /soap>\n" .
       "    SetHandler          perl-script\n" .
       "    PerlHandler         Bric::SOAP::Handler\n" .
-      "   PerlAccessHandler    Apache::OK\n" .
+      "   PerlAccessHandler    Apache2::Const::OK\n" .
       "  </Location>";
 
     if (ENABLE_DIST) {
@@ -209,8 +209,8 @@
           "  <Location /perl-status>\n" .
           "    SetHandler          perl-script\n" .
           "    PerlHandler         Apache::Status\n" .
-          "    PerlAccessHandler   Apache::OK\n" .
-          "    PerlCleanupHandler  Apache::OK$fix\n" .
+          "    PerlAccessHandler   Apache2::Const::OK\n" .
+          "    PerlCleanupHandler  Apache2::Const::OK$fix\n" .
           "  </Location>";
     }
 
@@ -231,7 +231,7 @@
             push @locs,
               "  <Location $prev_loc>\n" .
               "    PerlFixupHandler    " .
-                   qq{"sub { \$_[0]->no_cache(1); return Apache::OK; }"\n} .
+                   qq{"sub { \$_[0]->no_cache(1); return Apache2::Const::OK; }"\n} .
               "  </Location>";
         }
     }

Modified: bricolage/branches/dev_apache2/lib/Bric/App/ApacheStartup.pm
===================================================================
--- bricolage/branches/dev_apache2/lib/Bric/App/ApacheStartup.pm	2005-08-31 21:20:52 \
                UTC (rev 6629)
+++ bricolage/branches/dev_apache2/lib/Bric/App/ApacheStartup.pm	2005-08-31 21:31:28 \
UTC (rev 6630) @@ -45,7 +45,7 @@
 # modules loaded below will get debugging symbols.
 our $DEBUGGING;
 BEGIN { 
-  if(Apache->define('BRICOLAGE_DEBUG')) {
+  if(Apache2::ServerUtil->exists_config_define('BRICOLAGE_DEBUG')) {
     require Apache::DB;
     Apache::DB->init;
     $DEBUGGING = 1;

Modified: bricolage/branches/dev_apache2/lib/Bric/App/Auth.pm
===================================================================
--- bricolage/branches/dev_apache2/lib/Bric/App/Auth.pm	2005-08-31 21:20:52 UTC (rev \
                6629)
+++ bricolage/branches/dev_apache2/lib/Bric/App/Auth.pm	2005-08-31 21:31:28 UTC (rev \
6630) @@ -49,8 +49,8 @@
 
 ################################################################################
 # Programmatic Dependences
-use Apache::Constants qw(:common);
-use Apache::Log;
+use Apache2::Const qw(:common);
+use Apache2::Log;
 use Bric::Config qw(:auth :cookies);
 use Bric::App::Session qw(:user);
 use Bric::App::Cache;
@@ -92,7 +92,7 @@
 ################################################################################
 # Instance Fields
 BEGIN {
-    $cookie_class = $ENV{MOD_PERL} ? 'Apache::Cookie' : 'CGI::Cookie';
+    $cookie_class = $ENV{MOD_PERL} ? 'Apache2::Cookie' : 'CGI::Cookie';
     eval "require $cookie_class";
 }
 

Modified: bricolage/branches/dev_apache2/lib/Bric/App/Authz.pm
===================================================================
--- bricolage/branches/dev_apache2/lib/Bric/App/Authz.pm	2005-08-31 21:20:52 UTC (rev \
                6629)
+++ bricolage/branches/dev_apache2/lib/Bric/App/Authz.pm	2005-08-31 21:31:28 UTC (rev \
6630) @@ -50,8 +50,8 @@
 # Programmatic Dependences
 use Bric::Util::Priv::Parts::Const qw(:all);
 use Bric::App::Session qw(:user user_is_admin);
-use Apache;
-use Apache::Request;
+#use Apache2;
+use Apache2::Request;
 
 ################################################################################
 # Inheritance
@@ -148,7 +148,7 @@
         my $id = $obj->get_id;
         $id = '' unless defined $id;
         my $key = "_AUTHZ_:$ref:$id";
-        my $r = Apache::Request->instance(Apache->request);
+        my $r = Apache2::Request->instance(Apache2::RequestUtil->request);
         unless (defined ($perm = $r->pnotes($key))) {
             $perm = get_user_object()->what_can($obj, @gids);
             $r->pnotes($key, $perm);

Modified: bricolage/branches/dev_apache2/lib/Bric/App/Callback/Profile/Contrib.pm
===================================================================
--- bricolage/branches/dev_apache2/lib/Bric/App/Callback/Profile/Contrib.pm	2005-08-31 \
                21:20:52 UTC (rev 6629)
+++ bricolage/branches/dev_apache2/lib/Bric/App/Callback/Profile/Contrib.pm	2005-08-31 \
21:31:28 UTC (rev 6630) @@ -5,6 +5,7 @@
 use constant CLASS_KEY => 'contrib';
 
 use strict;
+# FIXME - http://perl.apache.org/docs/2.0/user/porting/compat.html#C_Apache__Util__escape_uri___
  use Apache::Util qw(escape_uri);
 use Bric::App::Callback::Util::Contact qw(update_contacts);
 use Bric::App::Event qw(log_event);

Modified: bricolage/branches/dev_apache2/lib/Bric/App/Callback/Search.pm
===================================================================
--- bricolage/branches/dev_apache2/lib/Bric/App/Callback/Search.pm	2005-08-31 \
                21:20:52 UTC (rev 6629)
+++ bricolage/branches/dev_apache2/lib/Bric/App/Callback/Search.pm	2005-08-31 \
21:31:28 UTC (rev 6630) @@ -10,7 +10,7 @@
 use Bric::Config qw(FULL_SEARCH);
 
 sub no_new_search {
-    my $r = Apache::Request->instance(Apache->request);
+    my $r = Apache2::Request->instance(Apache2::RequestUtil->request);
     $r->pnotes(CLASS_KEY . '.no_new_search' => 1);
 }
 

Modified: bricolage/branches/dev_apache2/lib/Bric/App/CleanupHandler.pm
===================================================================
--- bricolage/branches/dev_apache2/lib/Bric/App/CleanupHandler.pm	2005-08-31 21:20:52 \
                UTC (rev 6629)
+++ bricolage/branches/dev_apache2/lib/Bric/App/CleanupHandler.pm	2005-08-31 21:31:28 \
UTC (rev 6630) @@ -54,7 +54,7 @@
 
 ################################################################################
 # Programmatic Dependences
-use Apache::Constants qw(OK);
+use Apache2::Const qw(OK);
 use Bric::App::Session;
 use Bric::App::Event qw(commit_events);
 use Bric::Util::DBI qw(:trans);

Modified: bricolage/branches/dev_apache2/lib/Bric/App/Handler.pm
===================================================================
--- bricolage/branches/dev_apache2/lib/Bric/App/Handler.pm	2005-08-31 21:20:52 UTC \
                (rev 6629)
+++ bricolage/branches/dev_apache2/lib/Bric/App/Handler.pm	2005-08-31 21:31:28 UTC \
(rev 6630) @@ -58,8 +58,8 @@
 use Bric::Util::Trans::FS;
 use Bric::App::Event qw(clear_events);
 use Bric::App::Util qw(del_redirect add_msg get_pref);
-use Apache::Constants qw(OK);
-use Apache::Log;
+use Apache2::Const qw(OK);
+use Apache2::Log;
 use HTML::Mason '1.16';
 use HTML::Mason::ApacheHandler;
 

Modified: bricolage/branches/dev_apache2/lib/Bric/App/PreviewHandler.pm
===================================================================
--- bricolage/branches/dev_apache2/lib/Bric/App/PreviewHandler.pm	2005-08-31 21:20:52 \
                UTC (rev 6629)
+++ bricolage/branches/dev_apache2/lib/Bric/App/PreviewHandler.pm	2005-08-31 21:31:28 \
UTC (rev 6630) @@ -45,10 +45,10 @@
 
 ################################################################################
 # Programmatic Dependences
-use Apache::Constants qw(DECLINED OK);
+use Apache2::Const qw(DECLINED OK);
 use Bric::Config qw(:prev :err);
 use Bric::Util::Trans::FS;
-use Apache::Log;
+use Apache2::Log;
 
 ################################################################################
 # Inheritance

Modified: bricolage/branches/dev_apache2/lib/Bric/App/Session.pm
===================================================================
--- bricolage/branches/dev_apache2/lib/Bric/App/Session.pm	2005-08-31 21:20:52 UTC \
                (rev 6629)
+++ bricolage/branches/dev_apache2/lib/Bric/App/Session.pm	2005-08-31 21:31:28 UTC \
(rev 6630) @@ -63,7 +63,7 @@
 use Bric::Util::Trans::FS;
 
 use File::Path qw(mkpath);
-use Apache::Cookie;
+use Apache2::Cookie;
 
 #==============================================================================#
 # Inheritance                          #
@@ -244,7 +244,7 @@
     my ($r, $new) = @_;
     return if !$new && tied %HTML::Mason::Commands::session;
     # Grab the existing cookie.
-    my %cookies = Apache::Cookie->fetch;
+    my %cookies = Apache2::Cookie->fetch;
     my $cookie = $cookies{&COOKIE} unless $new;
 
     # Try to tie the session variable to a session file.
@@ -270,7 +270,7 @@
 
     # Create a new cookie if one doesn't exist.
     unless ($cookie) {
-        my $cookie = Apache::Cookie->new($r,
+        my $cookie = Apache2::Cookie->new($r,
                          -name    => COOKIE,
                          -value   => $HTML::Mason::Commands::session{_session_id},
                          -path    => '/');
@@ -355,7 +355,7 @@
       if $@;
 
     # Expire the session cookie.
-    my $cookie = Apache::Cookie->new($r,
+    my $cookie = Apache2::Cookie->new($r,
                      -name    => COOKIE,
                      -expires => "-1d",
                      -value   => 'Expired',

Modified: bricolage/branches/dev_apache2/lib/Bric/App/Util.pm
===================================================================
--- bricolage/branches/dev_apache2/lib/Bric/App/Util.pm	2005-08-31 21:20:52 UTC (rev \
                6629)
+++ bricolage/branches/dev_apache2/lib/Bric/App/Util.pm	2005-08-31 21:31:28 UTC (rev \
6630) @@ -44,11 +44,11 @@
 use Bric::Config qw(:cookies :mod_perl);
 use Bric::Util::Class;
 use Bric::Util::Pref;
-use Apache;
-use Apache::Request;
+#use Apache2;
+use Apache2::Request;
 use HTML::Mason::Request;
-use Apache::Constants qw(HTTP_OK);
-use Apache::Util qw(escape_html);
+use Apache2::Const qw(HTTP_OK);
+use HTML::Entities qw(encode_entities);
 use HTTP::BrowserDetect;
 use Bric::Util::Language;
 use Bric::Util::Fault qw(throw_gen);
@@ -488,7 +488,7 @@
     # cookies to 2nd server build hash of cookies from blessed reference into
     # Apache::Tables
     my %cookies;
-    my $r = Apache::Request->instance(Apache->request);
+    my $r = Apache2::Request->instance(Apache2::RequestUtil->request);
     $r->err_headers_out->do(sub {
         my($k,$v) = @_;     # foreach key matching Set-Cookie
         ($k,$v) = split('=',$v,2);
@@ -630,7 +630,7 @@
 
 sub status_msg {
     if (MOD_PERL) {
-        _send_msg(escape_html(Bric::Util::Language->instance->maketext(@_)));
+        _send_msg(encode_entities(Bric::Util::Language->instance->maketext(@_)));
     } else {
         print STDERR Bric::Util::Language->instance->maketext(@_);
     }
@@ -639,7 +639,7 @@
 sub severe_status_msg {
     if (MOD_PERL) {
     _send_msg('<span style="font-weight: bold; font-color: red;">' .
-              escape_html(Bric::Util::Language->instance->maketext(@_)) .
+              encode_entities(Bric::Util::Language->instance->maketext(@_)) .
               "</span>");
     } else {
         print STDERR "##################################################\n\n";
@@ -696,7 +696,7 @@
     my $session = Bric::App::Session->instance();
     my $history = $session->{'_history'};
 
-    my $r = Apache::Request->instance(Apache->request);
+    my $r = Apache2::Request->instance(Apache2::RequestUtil->request);
     my $curr = $r->uri;
 
     # Only push this URI onto the stack if it is different than the top value

Modified: bricolage/branches/dev_apache2/lib/Bric/Dist/Handler.pm
===================================================================
--- bricolage/branches/dev_apache2/lib/Bric/Dist/Handler.pm	2005-08-31 21:20:52 UTC \
                (rev 6629)
+++ bricolage/branches/dev_apache2/lib/Bric/Dist/Handler.pm	2005-08-31 21:31:28 UTC \
(rev 6630) @@ -47,8 +47,8 @@
 use Bric::App::Util qw(:pref);
 use Bric::Util::Job;
 use Bric::Util::Time qw(:all);
-use Apache::Constants qw(HTTP_OK);
-use Apache::Log;
+use Apache2::Const qw(HTTP_OK);
+use Apache2::Log;
 
 ################################################################################
 # Inheritance

Modified: bricolage/branches/dev_apache2/lib/Bric/SOAP/Auth.pm
===================================================================
--- bricolage/branches/dev_apache2/lib/Bric/SOAP/Auth.pm	2005-08-31 21:20:52 UTC (rev \
                6629)
+++ bricolage/branches/dev_apache2/lib/Bric/SOAP/Auth.pm	2005-08-31 21:31:28 UTC (rev \
6630) @@ -6,8 +6,8 @@
 
 use Bric::App::Auth;
 use Bric::Util::Fault qw(throw_ap);
-use Apache;
-use Apache::Constants qw(OK FORBIDDEN);
+#use Apache2;
+use Apache2::Const qw(OK FORBIDDEN);
 
 use SOAP::Lite;
 import SOAP::Data 'name';
@@ -84,7 +84,7 @@
   my $pkg = shift;
   my $env = pop;
   my $args = $env->method || {};
-  my $r = Apache->request;
+  my $r = Apache2::RequestUtil->request;
 
   # check for required args
   throw_ap(error => __PACKAGE__ . "::login : missing required parameter 'username'")

Modified: bricolage/branches/dev_apache2/lib/Bric/SOAP/Element.pm
===================================================================
--- bricolage/branches/dev_apache2/lib/Bric/SOAP/Element.pm	2005-08-31 21:20:52 UTC \
                (rev 6629)
+++ bricolage/branches/dev_apache2/lib/Bric/SOAP/Element.pm	2005-08-31 21:31:28 UTC \
(rev 6630) @@ -433,7 +433,7 @@
         # Convert the name to a key name, if needed.
         unless (defined $edata->{key_name}) {
             ($edata->{key_name} = lc $edata->{name}) =~ y/a-z0-9/_/cs;
-            my $r = Apache::Request->instance(Apache->request);
+            my $r = Apache2::Request->instance(Apache2::RequestUtil->request);
             $r->log->warn("No key name in element loaded via SOAP. "
                           . "Converted '$edata->{name}' to "
                           . "'$edata->{key_name}'");

Modified: bricolage/branches/dev_apache2/lib/Bric/SOAP/Handler.pm
===================================================================
--- bricolage/branches/dev_apache2/lib/Bric/SOAP/Handler.pm	2005-08-31 21:20:52 UTC \
                (rev 6629)
+++ bricolage/branches/dev_apache2/lib/Bric/SOAP/Handler.pm	2005-08-31 21:31:28 UTC \
(rev 6630) @@ -23,7 +23,7 @@
     SetHandler perl-script
     PerlHandler Bric::SOAP::Handler
     PerlCleanupHandler Bric::App::CleanupHandler
-    PerlAccessHandler Apache::OK
+    PerlAccessHandler Apache2::Const::OK
   </Location>
 
 =head1 DESCRIPTION
@@ -88,10 +88,10 @@
 use Bric::App::Event qw(clear_events);
 use Bric::App::Util qw(:pref);
 use Exception::Class 1.12;
-use Apache;
-use Apache::Request;
-use Apache::Constants qw(OK);
-use Apache::Util qw(escape_html);
+#use Apache2;
+use Apache2::Request;
+use Apache2::Const qw(OK);
+use HTML::Entities qw(encode_entities);
 require Encode if ENCODE_OK;
 
 use constant SOAP_CLASSES => [qw(
@@ -120,7 +120,7 @@
     # Setup routines to serialize Exception::Class-based exceptions. It needs
     # to look like this (no, I'm not kidding):
     # sub SOAP::Serializer::as_Bric__Util__Fault__Exception__GEN {
-    #     [ $_[2], $_[4], escape_html($_[1]->error) ];
+    #     [ $_[2], $_[4], encode_entities($_[1]->error) ];
     # }
 
     foreach my $ec (Exception::Class->VERSION >= 1.20
@@ -129,7 +129,7 @@
     {
         $ec =~ s/::/__/g;
         eval qq{sub SOAP::Serializer::as_$ec {
-            [ \$_[2], \$_[4], escape_html(\$_[1]->error) ];
+            [ \$_[2], \$_[4], encode_entities(\$_[1]->error) ];
         }};
     }
 }
@@ -224,7 +224,7 @@
     clear_events();
 
     # Send the error(s) to the apache error log.
-    my $log = Apache->server->log;
+    my $log = Apache2::ServerUtil->server->log;
     $log->error($err->full_message);
     $log->error($more_err) if $more_err;
 
@@ -242,7 +242,7 @@
     my $caller = (caller(2))[3];
     $caller = (caller(3))[3] if $caller =~ /eval/;
     chomp(my $msg = join ' ', grep { defined } @_);
-    my $log = Apache->server->log;
+    my $log = Apache2::ServerUtil->server->log;
     my $err = Bric::Util::Fault::Exception->new("$caller: $msg");
     handle_err(0, 0, $err);
 }

Modified: bricolage/branches/dev_apache2/lib/Bric/Util/Trans/FS.pm
===================================================================
--- bricolage/branches/dev_apache2/lib/Bric/Util/Trans/FS.pm	2005-08-31 21:20:52 UTC \
                (rev 6629)
+++ bricolage/branches/dev_apache2/lib/Bric/Util/Trans/FS.pm	2005-08-31 21:31:28 UTC \
(rev 6630) @@ -119,15 +119,16 @@
     Bric::register_fields();
 
     # Set up the best escape_uri() function.
-    if ($ENV{MOD_PERL}) {
-        require Apache::Util;
-        rethrow_exception($@) if $@;
-        $escape_uri = \&Apache::Util::escape_uri;
-    } else {
+    # http://perl.apache.org/docs/2.0/user/porting/compat.html#C_Apache__Util__escape_uri___
 +    #if ($ENV{MOD_PERL}) {
+    #    require Apache::Util;
+    #    rethrow_exception($@) if $@;
+    #    $escape_uri = \&Apache::Util::escape_uri;
+    #} else {
         require URI::Escape;
         rethrow_exception($@) if $@;
         $escape_uri = \&URI::Escape::uri_escape;
-    }
+    #}
 }
 
 ################################################################################

Modified: bricolage/branches/dev_apache2/lib/Bric.pm
===================================================================
--- bricolage/branches/dev_apache2/lib/Bric.pm	2005-08-31 21:20:52 UTC (rev 6629)
+++ bricolage/branches/dev_apache2/lib/Bric.pm	2005-08-31 21:31:28 UTC (rev 6630)
@@ -73,8 +73,8 @@
 
 # Load the Apache modules if we're in mod_perl.
 if (defined MOD_PERL) {
-    require Apache;
-    require Apache::Request;
+    #require Apache2;
+    require Apache2::Request;
 }
 
 
@@ -178,10 +178,10 @@
 sub cache_lookup {
     if (defined MOD_PERL) {
         my ($pkg, $param) = @_;
-        my $req = Apache->request;
+        my $req = Apache2::RequestUtil->request;
         # We may be called during Apache startup
         return unless $req;
-        my $r = Apache::Request->instance($req);
+        my $r = Apache2::Request->instance($req);
         $pkg = ref $pkg || $pkg;
         while (my ($k, $v) = each %$param) {
             if (my $obj = $r->pnotes("$pkg|$k|" . lc $v)) {
@@ -561,10 +561,10 @@
         my $pkg = ref $self or return;
         # Skip unsaved objects.
         return unless defined $self->{id};
-        my $req = Apache->request;
+        my $req = Apache2::RequestUtil->request;
         # We may be called during Apache startup
         return $self unless $req;
-        my $r = Apache::Request->instance($req);
+        my $r = Apache2::Request->instance($req);
         # Cache it under its ID.
         $r->pnotes("$pkg|id|$self->{id}" => $self);
         # Cache it under other unique identifiers.
@@ -605,10 +605,10 @@
         my $pkg = ref $self or return;
         # Skip unsaved objects.
         return unless defined $self->{id};
-        my $req = Apache->request;
+        my $req = Apache2::RequestUtil->request;
         # We may be called during Apache startup
         return $self unless $req;
-        my $r = Apache::Request->instance($req);
+        my $r = Apache2::Request->instance($req);
 
         # Uncache it under its ID.
         $r->pnotes("$pkg|id|$self->{id}" => undef);

Modified: bricolage/branches/dev_apache2/t/Bric/App/Session/Test.pm
===================================================================
--- bricolage/branches/dev_apache2/t/Bric/App/Session/Test.pm	2005-08-31 21:20:52 UTC \
                (rev 6629)
+++ bricolage/branches/dev_apache2/t/Bric/App/Session/Test.pm	2005-08-31 21:31:28 UTC \
(rev 6630) @@ -37,9 +37,9 @@
 }
 
 ##############################################################################
-# Bogus Apache::Cookie module for testing.
+# Bogus Apache2::Cookie module for testing.
 ##############################################################################
-package Apache::Cookie;
+package Apache2::Cookie;
 
 use strict;
 use warnings;
@@ -54,7 +54,7 @@
     return bless \%args, ref $proto || $proto;
 }
 
-sub fetch { ( AUTH_COOKIE, Apache::Cookie->new(0, %ARGS) ) }
+sub fetch { ( AUTH_COOKIE, Apache2::Cookie->new(0, %ARGS) ) }
 sub value { $_[0]->{-value} }
 sub bake { %ARGS = %{$_[0]} }
 



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic