> ...
> I have begun to implement the web site using a simple binary state machine
> where the current page, based on user input, directs both the action (if
> any) and the next page. This 'next page' can follow any number of
different
> actions or even no action at all (in the case of a simple navigation). As
> such, I envisioned taking advantage of run modes to implement a two stage
> decision tree - ie, have each current page set an 'action' mode param
value
> and a 'new page' mode param value. Then, I could use run() to invoke the
> first (again, if any) subroutine, change the mode param, and then invoke
the
> second subroutine which would create the output.
Based on this, I understand that you have two parameters that are important
for deciding what your program should do -- the 'action' parameter and the
'new_page' parameter. Let's assume that 'action' is the same thing as run
mode. Based on this, submitting a form or clicking a link within your CGI
App will result in a run mode getting called (which is an action). There's
also the case where there is no action. For this case, I would create a run
mode called 'no_action' that maps to a function no_action().
The last line of each of your run modes should be something like this:
return $self->page($new_page);
(where $new_page is the value of the new_page param)
The page() function would be a simple decision tree:
sub page($$) {
$self = shift;
$new_page = shift;
return $self->show_page_1() if $new_page eq 'page_1';
return $self->show_page_2() if $new_page eq 'page_2';
return $self->show_page_3() if $new_page eq 'page_3';
# ...
return $self->default_page();
}
Let me know if I have this works for you. And good luck!
-Will
William R. Rico
CommonMind
18 W33 St, 2nd Fl
New York, NY 10001
http://www.commonmind.com/
Email: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]