I'm building an application which relies on CGI::FormBuilder to provide an online tool to manage the making of phone calls to a list.

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 $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"; }
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:

$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"; }
The method which is called from the snippet above includes the following dispatch logic.
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; }
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?

-- 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.

if( $lal && $lol ) { $life++; }

In reply to Twisted Logic Filling My Logs, w/o Rendering Form by hesco

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.