summaryrefslogtreecommitdiff
path: root/htetc
diff options
context:
space:
mode:
authorivan <ivan>2003-09-28 02:36:18 +0000
committerivan <ivan>2003-09-28 02:36:18 +0000
commitc8f80bd5aaeb0f3844a7cece4bfe250d4f89f745 (patch)
tree66edb155311f88b162e7073e2c6c14ac33c56db5 /htetc
parentc2a0b1b8e9d437434e326a3b573d7134c5697213 (diff)
add upload of batch result from TD Canada Trust
some global.asa / handler.pl enhancements
Diffstat (limited to 'htetc')
-rw-r--r--htetc/global.asa32
-rw-r--r--htetc/handler.pl47
2 files changed, 66 insertions, 13 deletions
diff --git a/htetc/global.asa b/htetc/global.asa
index 5b0ac49..f00ae57 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;
@@ -195,5 +196,36 @@ sub include {
$Response->Include(@_);
}
+if ( defined(@DBIx::Profile::ISA) ) {
+
+ #false laziness w/above
+ *redirect = sub {
+ my($location) = @_;
+
+ ${$Response->{BinaryRef}} =
+ $cgi->header.
+ qq!<HTML><BODY>Redirect to <A HREF="$location">$location</A>!.
+ '<BR><BR><PRE>'.
+ ( UNIVERSAL::can(dbh, 'sprintProfile')
+ ? encode_entities(dbh->sprintProfile())
+ : 'DBIx::Profile missing sprintProfile method;'.
+ 'unpatched or too old?' ).
+ "\n\n". &sprintAutoProfile(). '</PRE>'.
+ '</BODY></HTML>';
+
+ dbh->{'private_profile'} = {};
+
+ $Response->End;
+
+ };
+
+} else {
+
+ *redirect = sub {
+ $Response->Redirect(@_);
+ }
+
+}
+
1;
diff --git a/htetc/handler.pl b/htetc/handler.pl
index 8f079af..1660cb3 100644
--- a/htetc/handler.pl
+++ b/htetc/handler.pl
@@ -67,6 +67,7 @@ sub handler
use Date::Format;
use Date::Parse;
use Time::Local;
+ use File::Basename;
use Tie::IxHash;
use HTML::Entities;
use IO::Handle;
@@ -141,20 +142,10 @@ sub handler
} else { #normal redirect
- #http://www.masonhq.com/docs/faq/#how_do_i_do_an_external_redirect
- $m->clear_buffer;
- # The next two lines are necessary to stop Apache from re-reading
- # POSTed data.
- $r->method('GET');
- $r->headers_in->unset('Content-length');
- $r->content_type('text/html');
- #$r->err_header_out('Location' => $location);
- $r->header_out('Location' => $location);
- $r->header_out('Content-Type' => 'text/html');
- $m->abort(302);
-
+ $m->redirect($location);
'';
- }
+
+ }
};
@@ -168,6 +159,36 @@ sub handler
$m->scomp(@_);
}
+ sub redirect {
+ my( $location ) = @_;
+ use vars qw($m);
+ $m->clear_buffer;
+ #false laziness w/above
+ if ( defined(@DBIx::Profile::ISA) ) { #profiling redirect
+
+ $m->print(
+ qq!<HTML><BODY>Redirect to <A HREF="$location">$location</A>!.
+ '<BR><BR><PRE>'.
+ ( UNIVERSAL::can(dbh, 'sprintProfile')
+ ? encode_entities(dbh->sprintProfile())
+ : 'DBIx::Profile missing sprintProfile method;'.
+ 'unpatched or too old?' ).
+ #"\n\n". &sprintAutoProfile(). '</PRE>'.
+ "\n\n". '</PRE>'.
+ '</BODY></HTML>'
+ );
+ dbh->{'private_profile'} = {};
+
+ $m->abort(200);
+
+ } else { #normal redirect
+
+ $m->redirect($location);
+
+ }
+
+ }
+
} # end package HTML::Mason::Commands;
$r->content_type('text/html');