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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |