- #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);
-
- '';
+
+ if ( defined(@DBIx::Profile::ISA) ) { #profiling redirect
+
+ my $page =
+ 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'} = {};
+ return $page;
+
+ } 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);
+
+ '';
+ }
+