I thought I'd see if everybody can take a brief step back and consider something that
may help clarify where people are coming from.
I think most everyone agrees that CGI::Application is the 'Controller' in MVC. As a
controller it is in the business of making
decisions. That's what a controller is: a traffic cop/ arbiter. Since the
recommended usage of CGI::App is to sub-class it, that
means that your module, too, is in the business of making decisions.
So what happens to all that data-manipulation and output? My run modes typically look
like this:
sub run_mode {
my $self = shift;
my $output = '';
# RETRIEVE/STORE ----------------------
Code calling my Model modules goes here, with
a bit of munging when strictly necessary
# Display -----------------------------
Call View modules (Template Toolkit in my case), passing
the useful tidbits from the retrieve/store portion
return $output;
}
This looks a lot like what Elizabeth was doing when she overrode run() to be a two
part process.
Now, there are instances when I don't want to display out put after the
#retrieve/store method either. I've chosen to go with a
redirect header in the Display portion. But my run mode above is playing traffic cop
in a static structure of "do this, then do
that". Playing arbiter looks slightly different.
sub run_mode {
my $self = shift;
# RETRIEVE/STORE ----------------------
Code calling my Model modules goes here, with
a bit of munging when strictly necessary
# FIGURE OUT RESPONSE------------------
Whatever it takes (if-then-else,for-as-switch,function call)
to figure out where we go next. Then call directly or redirect,
your preference.
}
I think the point I'm trying to make here is that run modes are as much a part of the
Controller as the CGI::Application module you
inherited from. It's still all about decisions/organizing the other parts of the
application.
My question to all involved, is what do you think the responsibilities of a run mode
are? Answering that will, IMHO, shed a lot of
light on things.
-Stephen
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]