Hello all, I'm just mulling over a framework design for this application I've been asked to build. Eventually, I wish to run this under mod_perl, so I'm plumping for the completely modular approach (with a start-up script loading modules). Here's my question however. I need to be able to process a number of actions submitted by the user, say "open_file" and "display_line". I'd like to keep those subroutines in a specific module which is AUTOLOADed (say base::Actions::DisplayStuff), just to prevent me from implicitly defining what every "action" does and importing all the modules. i.e. -
if ($act eq 'open_file'){ stuff; } elsif ( $act eq 'open_stuff') { stuff; } elsif ( $act eq 'speak' ) { stuff; }
Firstly I'm not sure whether this is an correct approach to adopt, and secondly I'm wondering how I might structure the AUTOLOAD function to load these extra modules. Should I actually use "require", or do I need to use that funky goto method ? Obviously I'm looking for maximum flexibility, but also reasonable execution speed.

I hope someone can understand this raving mess of a question ;)

kindest,

>joe


In reply to OO/Application Framework question by joeblow

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.