Re: MP2 - Make test Error - t/api/request_rec.t
[prev]
[thread]
[next]
[Date index for 2005/01/10]
cfaust-dougot wrote:
>>>sorry, I have no idea. If you reduce your code to a simple few-lines
>>>script/handler and post it here, I'm sure someone will figure out what the
>>>problem is, and whether it's an issue with your code or a bug in mp2.
>
>
> Thanks Stas, I'll take all the help I can get... I've been trying to figure this out all day without any luck, I thought I could put to rest any problems with code once I went with a content handler and put everything in a subdirectory so I could be sure I don't have any messy global values.
>
> This code has been working on a previous server with no problems, we are moving to a new server and this is the result of the same code but after a new apache and mod_perl install.
> In short I can sit there and refresh the same page and over and over, sometimes I get the right page, other times I get other pages
>
> Thanks in Advance!
> -Chris
>
> Below are the basics:
>
> Index.pm:
>
> package MALDEN::scripts::Index;
> use Apache::Const -compile => qw(:common REDIRECT OK);
> use strict;
> use Mail::Sendmail;
> use XML::RSS;
> use POSIX qw(strftime);
> use vars qw($db $r $CGI $user_name $user_role);
> ##########################################################################################
> # Main
> # Our Mod_Perl Content Handler
> sub handler {
> $r = shift;
> # Define our root HTML template path
> $ENV{'HTML_TEMPLATE_ROOT'} = "/websites/MALDEN/templates";
> # Create a new global CGI object
> $CGI = new CGI();
> # Create a global DB connection
> $db = TOOLS::PublicConnectDB->connect_to_db();
> # Authenticate
> auth_incoming_user();
> # Determine what we want to do based on the request
> # Most functions will return "OK" after the "display page" subroutine
> # but for those that we have to redirect, the redirect directive and the URL will be returned
> my $back_url = "";
> my $request_type = "";
> ($request_type,$back_url) = determine_proper_action();
>
> # Properly Exit the Handler from all subs within Determine Proper Action
> if ($request_type eq 'Apache::REDIRECT') {
> $r->headers_out->set(Location => $back_url);
> return Apache::REDIRECT;
> } else {
> return Apache::OK;
> }
>
> } # End of Sub
You realize that this is not an a-few-lines-test-case. How can we analyze
or run it if it requires a database connection and non-existing
auth_incoming_user and other functions. Please reduce it to the case that
has no external dependencies and so that it still fails. I bet while you
are reducing that you will find the problematic code.
--
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@xxxxxx.xxx http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com