X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=htetc%2Fglobal.asa;h=f00ae57f53751a08a4f20ae9551afdcd755900f8;hp=6f76fd2565be092b16d4900896fb72b1eed2da1e;hb=c8f80bd5aaeb0f3844a7cece4bfe250d4f89f745;hpb=58d44fbe5eb9ab32e6d87063a4a3b22ddba9a828 diff --git a/htetc/global.asa b/htetc/global.asa index 6f76fd256..f00ae57f5 100644 --- a/htetc/global.asa +++ b/htetc/global.asa @@ -9,6 +9,7 @@ use CGI; use Date::Format; use Date::Parse; use Time::Local; +use File::Basename; use Tie::IxHash; use HTML::Entities; use IO::Handle; @@ -72,7 +73,8 @@ sub Script_OnStart { &cgisuidsetup($cgi); $p = popurl(2); #print $cgi->header( '-expires' => 'now' ); - dbh->{'private_profile'} = {} if dbh->can('sprintProfile'); + #dbh->{'private_profile'} = {} if dbh->can('sprintProfile'); + dbh->{'private_profile'} = {} if UNIVERSAL::can(dbh, 'sprintProfile'); #really should check for FS::Profiler or something # Devel::AutoProfiler _our_ VERSION? thanks a fucking lot @@ -109,7 +111,7 @@ sub Script_OnFlush { #$$ref = $cgi->header() . $$ref; #warn "Script_OnFlush called with dbh ". dbh. "\n"; #if ( dbh->can('sprintProfile') ) { - if ( UNIVERSAL::can(dbh,'sprintProfile') ) { + if ( UNIVERSAL::can(dbh, 'sprintProfile') ) { #warn "dbh can sprintProfile\n"; if ( lc($Response->{ContentType}) eq 'text/html' ) { #con #warn "contenttype is sprintProfile\n"; @@ -136,8 +138,12 @@ if ( defined(@DBIx::Profile::ISA) ) { my( $self, $location) = @_; my $page = $cgi->header. - qq!Redirect to $location

!. - '
'. encode_entities(dbh->sprintProfile()).
+      qq!Redirect to $location!.
+      '

'.
+        ( UNIVERSAL::can(dbh, 'sprintProfile')
+            ? encode_entities(dbh->sprintProfile())
+            : 'DBIx::Profile missing sprintProfile method;'.
+              'unpatched or too old?'                        ).
       "\n\n". &sprintAutoProfile().  '
'. ''; dbh->{'private_profile'} = {}; @@ -186,5 +192,40 @@ sub sprintAutoProfile { } +sub include { + $Response->Include(@_); +} + +if ( defined(@DBIx::Profile::ISA) ) { + + #false laziness w/above + *redirect = sub { + my($location) = @_; + + ${$Response->{BinaryRef}} = + $cgi->header. + qq!Redirect to $location!. + '

'.
+        ( UNIVERSAL::can(dbh, 'sprintProfile')
+            ? encode_entities(dbh->sprintProfile())
+            : 'DBIx::Profile missing sprintProfile method;'.
+              'unpatched or too old?'                        ).
+      "\n\n". &sprintAutoProfile().  '
'. + ''; + + dbh->{'private_profile'} = {}; + + $Response->End; + + }; + +} else { + + *redirect = sub { + $Response->Redirect(@_); + } + +} + 1;