hesco has asked for the wisdom of the Perl Monks concerning the following question:
The form loads fine. But when I submit my form using the 'Proceed to Next Household' button, when I'm hoping to be presented with the next household to call, I get instead an endless stream of debug output (mostly Data::Dumper's full of hashes being passed from one subroutine to the next, with occassional debug statements showing me progress through the script) filling my /var/log partition, which can only be halted by restarting the apache server. Simply killing the www-data owned perl process for the script does not do it.
My cgi script, invoked from the browser includes:
My $dashboard->_process_list_of_households() method taps the database and properly processes through that list and then invokes another internal method to render the form, which includes the following code:my $html = $dashboard->_process_list_of_households(); print STDERR "We made it back to cgi script.\n"; if(defined($html)){ print STDERR "canvas_hh_screen.cgi says that \$html is: $html \n"; print $html; } else { print STDERR "\$html remains undefined for some reason.\n"; }
The method which is called from the snippet above includes the following dispatch logic.$html = $self->_render_online_household_form(\%hh_values); if(defined($html)){ return $html; # print $html; } else { die "\$html remains undefined after ->_render_online_household +_form().\n"; }
Again, this works fine the first time through. But when I attempt to 'Proceed to Next Household' I'm getting an endless stream filling my logs and nothing new in the browser, until it eventually times out and returns an error message. What is it I'm missing here? How can I get this to work as I hope and intend, please?if($form->submitted && $form->validate){ my $field = $form->fields; if($form->submitted eq 'Proceed to Next Household'){ $self->_record_call_results($field); $www_hh_form = $form->render(header => 1); # $www_hh_form = $form->confirm(header => 1); # $www_hh_form .= "<pre>" . Dumper(\$field) . "</pre>"; return $www_hh_form; } elsif($form->submitted eq 'Save Results') { $self->_record_call_results($field); # $www_hh_form = $form->confirm(header => 1); $www_hh_form = $self->_render_dashboard(); $www_hh_form .= "<pre>" . Dumper(\$field) . "</pre>"; return $www_hh_form; } elsif($form->submitted eq 'Reset this Household') { my $record_count = $self->_reset_hh_call_results($field); $www_hh_form = $form->render(header => 1); return $www_hh_form; } else { print STDERR "Form invoked with illegal submit button from IP: \ +n"; die "Form invoked with illegal submit button from IP: \n"; } } else { print STDERR "OK, we'll render form for first time for this househ +old.\n"; $www_hh_form = $form->render(header => 1); return $www_hh_form; }
-- Hugh
UPDATE: I added a comment to answer the question below about my 'endless stream' of what?
UPDATE #2: I think I may have identified my issue. I had a two table join in the mix which when it encountered a household record with no phone number would return over two thousand residents for that household who also lacked a phone number. The 'endless stream of debug output' was the Data::Dumper of the hashes for each of those household residents. Apache would time out before processing the 2200+ records, but fill my logs in so doing. I've now added an additional WHERE clause to restrict that query (and another upstream of it) to results where the length(phone) > 6, so I stand a better chance of dealing with valid phone numbers and folks who are legitimately members of that household. My issue it seems was in a poorly constructed database query, not in the logic of my dispatch (which all looked fine to me, even though I've been blaming that dispatch code for two days while I scratched my head on this one in between other projects). Thank you shmem for pointing me back to the debug output I was already accumulating (in droves). It held the key, but was so voluminous as to be intimidating to examine closely. I continue to test but suspect I may be on the way here now.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Twisted Logic Filling My Logs, w/o Rendering Form
by shmem (Chancellor) on May 08, 2008 at 06:31 UTC | |
|
Re: Twisted Logic Filling My Logs, w/o Rendering Form
by TOD (Friar) on May 08, 2008 at 02:59 UTC | |
by hesco (Deacon) on May 08, 2008 at 03:42 UTC | |
|
Re: Twisted Logic Filling My Logs, w/o Rendering Form
by Anonymous Monk on May 08, 2008 at 04:19 UTC |