This debate could go on for ages. Let me say that I do agree with you and am playing devil's advocate to some extent. The point I am trying to make is that in some situations the standard way of doing things is not always the best.

I'll try to get this across by looking only at the first point - that putting the dispatch stuff in the main module can be a good idea for 'blackbox' apps.

The imaginary scenario: I have a blog app which runs under mod_perl. It is intended that the sys admin need only run perl-MCPAN -e 'install UberBlog' and then add this to their httpd.conf file:

<Location /foo/bar/blog/> SetHandler perl-script PerlHandler UberBlog::Dispatcher PerlSetVar UberBlog_DSN "dbi:Pg:dbname:uberblog" </Location>

Even the most novice sys-admin should be able to do that, and would then be able to forget about it as long as it all worked. When it comes to upgrading all she need do is run perl -MCPAN -e 'install UberBlog' again and it will all work.

If the user wants to dig into the internals then the name of the handler should give them a good clue as where to start.

All of the above could have been put into 'uberblog.conf' and then 'Include'd as you suggest, but then this file would have to be located on the filesystem somewhere and it would not be possible to upgrade it when the module got upgraded. This adds complexity that the user does not want. It could also couse real trouble if another admin on the same machine decides to upgrade the modules.

I think that there is merit in putting a fair amount of stuff in the main handler and running the show from there. There is also plenty of merit in not doing that though... I hope have have won you over to some extent with regards to the above scenario.


In reply to Re: Re: Re: Re: Re: mod_perl & TT2 Architecture by EvdB
in thread mod_perl & TT2 Architecture by tadamec

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.