sub start{ my ($app) = @_; # find out somehow what we really want as a start page return $self->admin_start() if $admin; return $self->member_start() if $member; return $self->public_start(); }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.You can put the logic to dispatch between different runmodes for all three groups into one CGI::App class
(it is, after all, one big application)If you do not want that file to become a real monster, you can split these runmodes across several files and/or modules. You can put runmodes in other packages, too, not only in the CGI::App class.
(Not sure, maybe this IS heresy...)Also, runmodes should contain only the control logic and the real work should be done somewhere else.
For example, put none of your database access stuff into the CGI::App.A runmode should just get the parameters it needs, check permissions, call some backend modules and produce the template.
You could do
sub start{ my ($app) = @_; # find out somehow what we really want as a start page return AdminRunmodes::start($self) if $admin; return MemberRunmodes::start($self) if $member; return PublicRunmodes::start($self); }
I would create a Public.pm, a Usertype1.pm, Usertype2.pm, Admin.pm, etc. These packages would hold the respective methods and such.
Good plan, I say.And these Public.pm, Usertype1.pm and so on do not have to be CGI::App subclasses themselves to implement runmodes.
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
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.