[cgiapp] Re: packages autouse?

Porta julian.porta at gmail.com
Thu Jun 11 18:19:37 EDT 2009


Let me clarify.
Using CAD, I have a directory that contains (what I'll call)
Controllers. These Controllers are CA based packages, and each one of those
manages different parts of my web application.

For example, the package Controller::Accounts contains all the different
runmodes related to account management in my web application. The package
Controller::Home contains all the runmodes related to home pages for my web
application users. And so on.

I'm using a ORM to map objects to tables. No surprise here. My application
uses different tables, for example a table User, a table Article, a table
Comment and so on. No surprise, also, I have a folder names Models which
contains different packages (which I'll call Models), named User, Article,
Comment, and so on.

So far, so good.

One thing that bothers me, is that on every Controller, I need to repeat the
same 15 lines of

package Controller::Accounts;

use User;
use Article;
use Comment;
...

In order to make my Models available on each Controller. Of course, I could
create a CGI::App package, add all the use lines there and base all my
Controllers on that package. Sure, less lines to type on each Controller.

But, every time I create a new Model, I need to make sure I added it on that
base package. Which I found annoying.

So, the question is: Does anyone knows a way to *solve* this ( I understand
it's not really a problem, but more a matter of personal preference ) other
than having a CA based package including all the packages under Models/ and
make all the Controllers inherit from that package?

I hope that clarifies the question.



On Thu, Jun 11, 2009 at 6:59 PM, Rhesa Rozendaal <perl at rhesa.com> wrote:

> Porta wrote:
>
>> My initial message was more related not to cgi app related modules,
>> but application related ones
>>
>
> I have no idea what you're saying here. Did you look at the implementation
> of Modern::Perl (or ex::caution)?
>
>
> rhesa
>
> #####  CGI::Application community mailing list  ################
> ##                                                            ##
> ##  To unsubscribe, or change your message delivery options,  ##
> ##  visit:  http://lists.openlib.org/mailman/listinfo/cgiapp    ##
> ##                                                            ##
> ##  Web archive:   http://lists.openlib.org/pipermail/cgiapp/   ##
> ##  Wiki:          http://cgiapp.erlbaum.net/                 ##
> ##                                                            ##
> ################################################################
>
>


More information about the cgiapp mailing list