i am trying to write some code with MVC design in mind. the setup is frontend class, adaptor class, then backend class that does the real work. class methods are used extensively in order to call from one class to another class. here is one example:
package MyApp::Frontend;
use MyApp::Adaptor::Report;
sub get_report {
MyApp::Adaptor::Report->get_report($report_id);
}
package MyApp::Adaptor::Report;
use MyApp::Backend::Report;
sub get_report {
# some business logic such as check if report exist, etc.
MyApp::Backend::Report->get_report(...);
}
then the backend could be a csv file, ldap or mysql.
the design should work but i am unhappy with so many class method calls. i am wondering if there is a shortcut or better, a OO design pattern that can help me here.
i have seen some catalyst examples and i like the way it look:
$c->model('Adaptor::Report')->get_report(..);
it doesn't use class method and loads the module automatically at compile-time too(based on here ). however reading the catalyst src is too challenge for me.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.