We can't predict the maximum number of members, so the entry page has two submit buttons: one indicating we have another member to fill in, and another for indicating we're done and should save all the information to the database.

...

I haven't studied C::P enough to know if it will handle this sort of thing better, but I suspect it will.

Yes. The basic theory is that there's an app-wide "dispatch" that figures out what state you are in. Then a specific "respond" gets called, which can notice which button was pressed, and return whether to stay on the same page (return $self), or go to a new page (return $self->nametopage("next")). Whichever page gets selected for rendering then does the render thing.

To me, this makes a lot of sense in practice. When you're editing a given page, you have one editor window open on the .tt file, which describes how it looks and what fields it returns, and another window open on the .pm file, which describes what to do with those fields and what to do next. You also add in that same file extra methods for supplying your template with data while that page is being rendered. It's all quite natural and flexible.

And groups of pages can have common ancestors, below the top level app, so the nested hierarchy and "two level" dispatch is there through the proper use of SUPER. It's just objects. Objects work.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.


In reply to •Re^2: Review: CGI::Prototype by merlyn
in thread Review: CGI::Prototype by dragonchild

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.