At 01:01 PM 06/11/02 -0400, John Siracusa wrote:
>On 6/11/02 12:46 PM, Perrin Harkins wrote:
>> John Hurst wrote:
>>> Still, I don't think that replacing this:
>>> 
>>> <Location /search>
>>>    SetHandler  perl-script
>>>    PerlHandler Controller::Search
>>> </Location>
>>> 
>>> with this:
>>> 
>>> [% Ctrl.Search() %]
>>> 
>>> makes Controller::Search any less a controller.
>> 
>> You're right.  It just looks kind of odd to me, invoking a template for
>> something that is not a display-related task.  It looks like the way
>> people typically do MVC in Mason or Embperl, with a first template that
>> doesn't do anything but invoke a module to take over the processing.
>
>...but it has several advantages.  I particularly appreciate being able to
>add to or change parameters or behaviors before passing things off to the
>controller, for example.  I can have several "variants" of the same
>controller living at different URLs, all pointing back to a single
>controller object.

This is how CGI::Application works, but instead of calling a template page,
it calls a script. The script is tiny -- defines a "run mode", and perhaps
parameters -- then calls the main script that does the heavy lifting, which
in turn instantiates standard modules that provide standard functionality.

I was intrigued by it, because at the time I was using a different approach
with shopping software: each link or form action called the same script,
which would figure out what needed to be done. Kind of like the tail wags
the dog instead of the other way around.

This is outside of MVC, but is nonetheless intriguing. I'm wondering if, in
another 2-3 years, after the authors of the several Perl application
frameworks have had more time to refine their designs, there will be
convergence of issues like this.

Am I wrong, or is this field of web applications a developing field for
which there is no textbook principles of how to do it? Perl has enabled
several people to take different approaches to it, whereas Microsoft's ASP
is just one approach, PHP is just one approach, and I don't know if Java
has multiple approaches or what. Will the various Perl approaches converge
toward a common set of principles, and/or reveal as yet undiscerned
patterns and architectures? Or maybe I'm imagining too much here...

Ron

>
>Don't think of it as "invoking a template."  Just think off it as an
>inverted dispatch mechanism: the actions camp out at their locations, as
>opposed to having their locations (in the httpd.conf) pointing at the
>controller modules.  Or something... :)
>
>-John
>
>

Reply via email to