in reply to Re: CGI/Mod Perl Application Design philosophy - which way do we go?
in thread CGI/Mod Perl Application Design philosophy - which way do we go?

In my experience, this really comes down to the scale and lifetime of the application.

For a simple form collection app or some form of system that performs a simple administration task, I have used the action sequence. I generally have something along the lines of:
my $action = $query->param('ACTION'); unless(defined($action)) { $action = 'default'; }
and then my if else based tree. For example, I have written small apps that manage lookup tables for databases where the data they contain is less than 20 rows in size. Adding a confirmation screen then becomes:
if($action eq 'delete') { $confirmed = $query->param('CONFIRMED') if($confirmed eq 'yes') { # do stuff } else { # do other stuff } }
I find that this enables me to also port my code. Sadly, my new job involves some ASP programming (sigh) and have ported this technique to the small apps I have written there.

However, if your application will not allow a simple if-else tree followed with a simple confirmed -yes-no stage then pathinfo is my recommendation.So I will be keeping an eye out for the groupware book to see if I can pinch any ideas for my next large program.

But to continue the discussion, my last big app involved datadumping a hash into the form (after encrypting and mime encoding it) which proved a simple way of passing state information rather than parsing out a huge munge of hidden fields.

Could this be extended to tie the hash to disk instead and use a key on the form as the lookup to that tied file?