Rafiq Ismail (ADMIN) wrote:
> Now my problem is that I have to assign which
> Subclass I want to instantiate, based on the script and params.

So, you're asking how to map URLs to perl modules?  Is there some reason 
you aren't simply using httpd.conf or Apache::Dispatch?  In my last MVC 
design, we had all of our controllers inherit from one base controller 
that held all of the common code.  Then we could just map from URLs to 
the specific controllers that handled them:

<Location /mycontroller>
   SetHandler  perl-script
   PerlHandler My::Controller
</Location>

> I my last
> effort I went for a Shared datastructure holding (script, control module
> pairs) which then allowed one to be dynamically "eval 'use..'"'ed in the
> main content handler.  I found that clunky.

There's no good reason to do an eval 'use'.  Use require instead, and 
import if you need to (but most people don't).

> I'm building from scratch
> again and am thinking of just firing up a template and allowing the
> control to be loaded INTO the view as a template toolkit plugin.  What I
> hate about this is that I'm surrendering my View layer.

I agree, that's a bad idea and certainly not MVC.

- Perrin

Reply via email to