> Hi Tim & Elizabeth --
> 
> Regarding this (very interesting!) conversation, I
> think I just had a
> "moment of clarity" about which I'm interested in
> your feedback.
> 
> 
> A while back, Elizabeth wrote this:
> 
> > My original idea was for the base class to look
> > something like this:
> >
> > subroutine run {
> >     my $rm_output = action();
> >     return output( $rm_output );
> > }
> >
> > where action() was a (private?) subroutine that
> invoked the correct
> run_mode
> > call and output() formatted and printed the
> output.  In this way the
> current
> > implementation of run is not altered in the least
> - just modularized a
> > little.
> 
> 
> Instead of putting this in the run() method, what if
> you created a single
> run-mode which ran your entire application?  Call it
> "ubermode":
> 
> 
>       sub setup {
>               my $self = shift;
>               $self->run_modes(
>                       'ubermode' => \&ubermode
>               );
>               $self->start_mode('ubermode');
>       }
> 
>       sub ubermode {
>               my $self =  shift;
>               my $rm_output = $self->action();
>               return $self->output( $rm_output );
>       }
> 
>       ## Private methods  ##
>       sub action {
>               my $self =  shift;
>               my $action_output;
>               # invoke the correct run_mode call 
>               return $action_output;
>       }
> 
>       sub output {
>               my $self =  shift;
>               my $output_output;
>               # format and print the output
>               return $output_output;
>       }
> 
> 
> 
> Would this not do exactly what you want?
> 
> -Jesse-

I don't know about Tim and Elizabeth (I get the digest
so don't know if they've responded yet), but this
works for me!!  I've got a multipage database front
end that needs to handle both inserts on new records,
and updates on existing records.  I'm using a naming
convention for my templates, Page1.html, Page2.html,
and then pass the page number as a hidden field named
'origin'.  I don't want a seperate run mode for each
page though, because they all basically do the same
thing: insert or update a database record.  

Which database action is performed is determined by
the NAME of the submit button, and the buttons are
generated by a subroutine that knows whether to
display '< Back', and/or 'Next >' based on the last
consecutive template number, using the same naming
convention indicated above.  And what table and column
to use for the database action is determined by a
naming convention for the html form fields, for
instance: 'DB_encounter_firstConsultDate',
'DB_patient_state_enumVals'.  The second and third
'fields' of the name indicate the table and column,
and the optional fourth field indicates a subroutine:
this is typically used to display a default value if
the database action is a new insert.

So, your idea of an ubermode is just what I'm looking
for, then your suggested private 'action' method can
take care of all this other processing 'under the
hood', and/or implement special functionality, for
instance, for page 1, where I need to get an id from
the database to pass from page to page.

Thanks!

=====
George M. Jempty
Database Admin/Intranet Architect
Regional West Medical Center
Scottsbluff, Nebraska
[EMAIL PROTECTED][EMAIL PROTECTED]

__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to