Can I use 'multi-runmodes' with C::A?

If I'm understanding what you mean by "multi-runmodes" correctly - the answer is no. I would class that as a feature of CGI::Application - it encourages a clear separation of the application logic into a single controller class.

Why not to use my code?

Well - if it does what you want nothing at all :-)

That said, if I saw the following in a code review I would worry and query the author:

$action =~ s/^_+//; #filtering private methods $what_to_do->$action() || displayQueryScreen ();

Even though you're renaming method names that start with an "_", running arbitrary methods based on user input is normally considered a "bad" thing.

While it may be safe with the current classes/methods it puts the burden of doing safe things in the wrong place (the modules rather than the caller).

If somebody adds a method to a class that could potentially do something dangerous - your CGI application is suddenly unsafe.

If you had had a list of approved "safe" methods and checked the supplied $action against it your system would not run the dangerous method.

On a slightly more abstract level you lose a lot of the advantages that CGI::Application gives you (inheritance, reuse, etc.)

The fact that you need so many classes to implement your application would also worry me. It would suggest that there is another level of abstraction that you need to look for... but I could be wrong :-)


In reply to Re: multi of so called "runmodes" by adrianh
in thread multi of so called "runmodes" by well

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.