Esteemed Monks,

But for once the unanticipated behaviour is actually very useful! I was working on this method from my CGI::Application based webapp when I got interupted. Without thinking I ran the ocde and it did what I need. But I new I hadn't used the $form->output method to get the final HTML fragment for the form, which I was then going to pass through HTML::FillInForm. It turns out that passing \$form to HTML::FillInForm got me the results I wanted anyway - BEFORE I had parsed the template.

Here is the code fragment, it works and for that I am grateful, but I am not sure why! Can somebody help me understand please?

sub en_display { # Display 'full signup or enroll' form my $self = shift; my $errs = shift; my $form_output =''; my $sess = $self->param('up_session'); my %data = ''; my $page = $self->load_tmpl('gila/index.html'); my $form = $self->load_tmpl('ap_enroll.html', die_on_bad_params => + 0); # If _IS_USER is present and _IS_REGISTERED is set then we have pa +rtial data in the DB. if ( $sess->param('_IS_USER') && $sess->param('_IS_REGISTERED') && + !ref $errs ) { my $obj = AppSys::User->search( 'upusername' => $sess->param(' +_IS_USER')); while ( my $usr = $obj->next ) { foreach ( $usr->columns ) { $data{$_} = $usr->$_; } } # Get partial data into form, add to page and output my $fif = HTML::FillInForm->new(); $fif->fill(scalarref => \$form, fdat => \%data); $page->param('form_text' => $form->output()); return $page->output(); } elsif ( ref $errs ) { # If there are errors then D::FV has handled HTML stuff $form->param($errs); $page->param('form_text' => $form->output()); return $page->output(); } else { # No partial, no errors, just output blank form $page->param('form_text' => $form->output()); return $page->output(); } }
jdtoronto

In reply to Unexpected behaviour in HTML::FillInForm by jdtoronto

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.