[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.9.4-10-ga4eb919

Jesse Vincent jesse at bestpractical.com
Wed Sep 29 11:09:29 EDT 2010


The branch, 3.9-trunk has been updated
       via  a4eb919243b74da6c6f3e07b70ac04c422ce9a34 (commit)
       via  58b4277f8f9f340628dedeca0359f7228ff8b01d (commit)
      from  27b78683cdcbfffa2efa6116251a73c827aab962 (commit)

Summary of changes:
 .perltidyrc                        |   14 ++++++++++++++
 bin/fastcgi_server.in              |   19 +------------------
 bin/mason_handler.fcgi.in          |   18 +-----------------
 bin/mason_handler.scgi.in          |   11 ++---------
 bin/mason_handler.svc.in           |   18 ++----------------
 lib/RT/Interface/Web/Handler.pm    |   30 ++++++++++++++++++++++++++++++
 lib/RT/Interface/Web/Standalone.pm |    2 +-
 7 files changed, 51 insertions(+), 61 deletions(-)
 create mode 100644 .perltidyrc

- Log -----------------------------------------------------------------
commit 58b4277f8f9f340628dedeca0359f7228ff8b01d
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Wed Sep 29 10:42:45 2010 -0400

    Added a first draft perltidy for RT

diff --git a/.perltidyrc b/.perltidyrc
new file mode 100644
index 0000000..7ee7217
--- /dev/null
+++ b/.perltidyrc
@@ -0,0 +1,14 @@
+--maximum-line-length=78
+--indent-columns=4
+--continuation-indentation=4
+--standard-error-output
+--vertical-tightness=2
+--closing-token-indentation=1
+--paren-tightness=1
+--brace-tightness=1
+--square-bracket-tightness=1
+--block-brace-tightness=1
+--nospace-for-semicolon
+--no-outdent-long-quotes
+--cuddled-else
+--want-break-before="% + - * / x != == >= <= =~ !~ < > | & >= < = **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x="

commit a4eb919243b74da6c6f3e07b70ac04c422ce9a34
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Wed Sep 29 11:02:57 2010 -0400

    remove 3 almost identical but subtly diverged versions of "run mason"

diff --git a/bin/fastcgi_server.in b/bin/fastcgi_server.in
index 24f513f..e120758 100644
--- a/bin/fastcgi_server.in
+++ b/bin/fastcgi_server.in
@@ -227,24 +227,7 @@ while ( my $cgi = CGI::Fast->new ) {
     $ENV{'ENV'}    = '' if defined $ENV{'ENV'};
     $ENV{'IFS'}    = '' if defined $ENV{'IFS'};
 
-    Module::Refresh->refresh if RT->Config->Get('DevelMode');
-    RT::ConnectToDatabase();
-
-    my $interp = $RT::Mason::Handler->interp;
-    if (
-        !$interp->comp_exists( $cgi->path_info )
-        && $interp->comp_exists( $cgi->path_info . "/index.html" )
-    ) {
-        $cgi->path_info( $cgi->path_info . "/index.html" );
-    }
-
-    local $@;
-    eval { $RT::Mason::Handler->handle_cgi_object($cgi); };
-    if ($@) {
-        $RT::Logger->crit($@);
-    }
-    RT::Interface::Web::Handler->CleanupRequest;
-
+    RT::Interface::Web::Handler->HandleRequest($cgi);
     $proc_manager->pm_post_dispatch;
 }
 
diff --git a/bin/mason_handler.fcgi.in b/bin/mason_handler.fcgi.in
index 4451e74..e4040bc 100755
--- a/bin/mason_handler.fcgi.in
+++ b/bin/mason_handler.fcgi.in
@@ -65,23 +65,7 @@ while ( my $cgi = CGI::Fast->new ) {
     $ENV{'ENV'}    = '' if defined $ENV{'ENV'};
     $ENV{'IFS'}    = '' if defined $ENV{'IFS'};
 
-    Module::Refresh->refresh if RT->Config->Get('DevelMode');
-    RT::ConnectToDatabase();
-
-    my $interp = $RT::Mason::Handler->interp;
-    if (
-        !$interp->comp_exists( $cgi->path_info )
-        && $interp->comp_exists( $cgi->path_info . "/index.html" )
-    ) {
-        $cgi->path_info( $cgi->path_info . "/index.html" );
-    }
-
-    local $@;
-    eval { $RT::Mason::Handler->handle_cgi_object($cgi); };
-    if ($@) {
-        $RT::Logger->crit($@);
-    }
-    RT::Interface::Web::Handler->CleanupRequest(); 
+    RT::Interface::Web::Handler->HandleRequest($cgi);
 
 }
 
diff --git a/bin/mason_handler.scgi.in b/bin/mason_handler.scgi.in
index 04dd374..b229fa1 100755
--- a/bin/mason_handler.scgi.in
+++ b/bin/mason_handler.scgi.in
@@ -48,8 +48,8 @@
 # END BPS TAGGED BLOCK }}}
 package RT::Mason;
 
+use warnings;
 use strict;
-use vars '$Handler';
 use File::Basename;
 
 require (dirname(__FILE__) . '/webmux.pl');
@@ -57,12 +57,5 @@ require (dirname(__FILE__) . '/webmux.pl');
 require CGI;
 
 my $cgi = CGI->new;
-if ( ( !$Handler->interp->comp_exists( $cgi->path_info ) )
-    && ( $Handler->interp->comp_exists( $cgi->path_info . "/index.html" ) ) ) {
-    $cgi->path_info( $cgi->path_info . "/index.html" );
-}
-
-RT::ConnectToDatabase();
-$Handler->handle_cgi_object($cgi);
-RT::Interface::Web::Handler->CleanupRequest();
+RT::Interface::Web::Handler->HandleRequest($cgi);
 1;
diff --git a/bin/mason_handler.svc.in b/bin/mason_handler.svc.in
index 1cb50d8..097b64a 100755
--- a/bin/mason_handler.svc.in
+++ b/bin/mason_handler.svc.in
@@ -225,26 +225,12 @@ warn "Begin listening on $ENV{'FCGI_SOCKET_PATH'}\n";
 require CGI::Fast;
 
 RT::Init();
-$Handler ||= RT::Interface::Web::Handler->new(
-    RT->Config->Get('MasonParameters')
-);
+$Handler ||= RT::Interface::Web::Handler->new( RT->Config->Get('MasonParameters'));
 
 
 # Response loop
 while( my $cgi = CGI::Fast->new ) {
-    my $comp = $ENV{'PATH_INFO'};
-
-    $comp = $1 if ($comp =~ /^(.*)$/);
-    my $web_path = RT->Config->Get('WebPath');
-    $comp =~ s|^\Q$web_path\E\b||i;
-    $comp .= "index.html" if ($comp =~ /\/$/);
-    $comp =~ s/.pl$/.html/g;
-    
-    warn "Serving $comp\n";
-
-    $Handler->handle_cgi($comp);
-    RT::Interface::Web::Handler->CleanupRequest();
-    # _should_ always be tied
+    $Handler->HandleRequest($cgi);
 }
 
 1;
diff --git a/lib/RT/Interface/Web/Handler.pm b/lib/RT/Interface/Web/Handler.pm
index 2b292fa..2a527bb 100644
--- a/lib/RT/Interface/Web/Handler.pm
+++ b/lib/RT/Interface/Web/Handler.pm
@@ -165,6 +165,36 @@ sub NewHandler {
     return($handler);
 }
 
+
+=head2 HandleRequest
+
+
+=cut
+
+sub HandleRequest {
+    my $self = shift;
+    my $cgi = shift;
+
+    Module::Refresh->refresh if RT->Config->Get('DevelMode');
+    RT::ConnectToDatabase() unless RT->InstallMode;
+
+    my $interp = $RT::Mason::Handler->interp;
+    if (   !$interp->comp_exists( $cgi->path_info )
+         && $interp->comp_exists( $cgi->path_info . "/index.html" ) )
+    {
+        $cgi->path_info( $cgi->path_info . "/index.html" );
+    }
+
+    local $@;
+    eval { $RT::Mason::Handler->handle_cgi_object($cgi); };
+    if ($@) {
+        $RT::Logger->crit($@);
+    }
+    $self->CleanupRequest();
+
+}
+
+
 =head2 CleanupRequest
 
 Clean ups globals, caches and other things that could be still
diff --git a/lib/RT/Interface/Web/Standalone.pm b/lib/RT/Interface/Web/Standalone.pm
index ff02f50..57158b4 100755
--- a/lib/RT/Interface/Web/Standalone.pm
+++ b/lib/RT/Interface/Web/Standalone.pm
@@ -71,12 +71,12 @@ sub default_mason_config {
 } 
 
 sub handle_request {
-
     my $self = shift;
     my $cgi = shift;
 
     Module::Refresh->refresh if RT->Config->Get('DevelMode');
     RT::ConnectToDatabase() unless RT->InstallMode;
+
     $self->SUPER::handle_request($cgi);
     $RT::Logger->crit($@) if $@ && $RT::Logger;
     warn $@ if $@ && !$RT::Logger;

-----------------------------------------------------------------------


More information about the Rt-commit mailing list