Qiang has asked for the wisdom of the Perl Monks concerning the following question:
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.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(...); }
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: MVC question: way to expose API
by rhesa (Vicar) on May 10, 2008 at 11:33 UTC | |
|
Re: MVC question: way to expose API
by roboticus (Chancellor) on May 10, 2008 at 12:16 UTC | |
by Anonymous Monk on May 12, 2008 at 03:13 UTC | |
|
Re: MVC question: way to expose API
by starbolin (Hermit) on May 11, 2008 at 04:43 UTC | |
|
Re: MVC question: way to expose API
by Qiang (Friar) on May 12, 2008 at 07:17 UTC |