[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cgiapp] a question about the order of operations


punkish wrote:
I read OrderOfOperations at
http://twiki.med.yale.edu/twiki2/bin/view/CGIapp/OrderOfOperations
so, here is my question.

seems like 1 and 2 will always run in that order, and then, hopefully,
3..6 will always run in that order. Now, if A and B will always run in
that order, they are really the same as AB. I can understand the point
of separating 3, 4, and 5..6 because 3 onward will _only_ happen under
a certain condtion (code being error free), and 4 is really
representative of possibly many things that I might do based on one
runmode, however, once again, if 5 and 6 are always going to run in
that order, then they may as well be one thing.

In other words, I could rephrase the above order as
my $webapp = WebApp->new();
  1. cgiapp_init_and_ setup()

if (everything is copacetic)

$webapp->run();
  2. cgiapp_prerun()
  3. the main instance runmode
  4. cgiapp_postrun_and_ teardown()


cgiapp_init and cgiapp_teardown are designed to provide functionality that can be inherited by sub classes. If I'm designing a module to use as a base class and I want to provide something like session intialization and teardown, then that's where I would do it. Then all sub classes can inherit this and implement their own setup() method (to defined their run modes, etc) without having to worry about overriding my init/teardown stuff.

Without these hooks you would need to make sure that anyone who used your mod would also do a $self->SUPER::setup() in their setup method. These hooks eliminate that.

--
Michael Peters
Developer
Plus Three, LP


---------------------------------------------------------------------
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.