On Thu, 20 Dec 2001, Tim Colson wrote:
> > I agree. What about adding another run mode to CGI::App to handle this.
> > return $self->return_rm($FORM{return_rm}, @args_to_pass_to_run_mode);
> > That would just be some syntactic sugar to rewrite the eval statement.
> True. I'd prefer though to have the sugar placed into the framework.
>
> As Elizabeth has pointed out, you've got a decision tree (albeit small)
> inside each of your run_mode/actions.
>
> "failed" - If validation fails -> send the form
> "success" - If validation ok, and save ok -> send the next page
Agreed.
> Why not just return those states and let the App figure out what to do? :-)
I think it's a question of organization and scale. Since I'm confident
that I will always make the same decisions upon success and failure of
validation, I prefer to have that logic right there in the code rather
than somewhere else, because it's more direct to read and debug.
However, in another case if I had the same logic throughout my
application _and_ I thought it might change, it would make sense to have
this "sub run-mode decision tree" abstracted. That use-case just hasn't
come for me yet, though. :)
> But the flipside of that coin is that if you've got those eval's in all your
> run-modes/actions... doesn't it make sense to move that task up into the
> parent fw and do it consistently in one place instead of copy/paste to a lot
> of actions?
I think you are right. I did copy and paste the eval syntax from
somewhere else, but I can remember the "return_rm" syntax more easily.
> Oh, and one final thought...with your eval and/or the
> $self->return_rm()...this binds one run_mode tightly to another run_mode.
> Seems to me, that each run_mode shouldn't really know anything about other
> run_modes. Breaks encapselation rules, doesn't it? Seems to me, it would
> make it harder to change and/or remove run_mode_foo if other run_modes could
> be calling directly to run_mode_foo(@arglist).
Hmm..I think if my run modes didn't know anything about each other, it
would be hard to move to one to the other in the application. :) That
is, even in a simple case, a run mode will produce HTML that "knows
about" about another run-mode. What I did was "link to" another run-mode
directly, instead of through the HTML.
-mark
http://mark.stosberg.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]