I'm reading through this thread with a little trepidation. Why not do this:
1) Put all the business rules OUTSIDE of C::A. Maybe, you put them in
other objects.
2) Have a $user object. That object contains everything that anyone
might want to know about a user. If you have anonymous usage, create
an anonymous $user.
3) Your runmodes only know how to dispatch to the object with the
right business rules. The runmode passes in the $user object.
4) The business rules figure out a bunch of stuff, then return a data
structure back to the runmode.
5) The runmode then figures out what format to print stuff in, then
hands the data structure to the right formatting module(s).
This is called MVC.
C::A is the Controller - it's the engine that puts everything together.
HTML::Template / Template Toolkit / PDF::Template / Excel::Template /
etc ... those are the View. They're how to take a generic data
structure and make it look good.
The rest of the stuff, including how to figure out if this $user
should see that $data ... that's the Model. It's the database, the
business rules, and the transformations between them.
I'm a big believer in making them separate, not only in idea, but in
code. Separate modules, separate namespaces, separate everything. If
you muddy the waters, you end up with something that's as clear as
mud, and about as fun to work with. My 2-year old like to play with
mud, but I certainly wouldn't trust him on my corporate intranet. :-)
Rob
On Fri, 10 Dec 2004 14:45:47 +0900, Thilo Planz <suppressed> wrote:
> >> yes, but once I have determined that I want, say, admin_start(), how
> >> would I instantiate an $admin_webapp object?
> >>
> >> I feel I might not be explaining this clearly. Let me try again --
> >
> > I do not think you need to have different $webapp objects.
>
> Having said that, if you wanted to "redirect" to a new $webapp object,
> something like this could work:
>
> $self->header_type('none');
> my $app = new AdminWebApp( QUERY => $self->query );
> $app->run;
> return '';
>
> But I really think, this (dispatching between functionality) is what
> run modes are for.
> Is anyone doing this?
>
>
>
> Thilo
>
> ---------------------------------------------------------------------
> Web Archive: http://www.mail-archive.com/suppressed/
> http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
> To unsubscribe, e-mail: suppressed
> For additional commands, e-mail: suppressed
>
>
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/suppressed/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.