in reply to CGI::Application usage question

I suggest you study the CGI::Application documentation a bit more (3.1 is the latest version which is what you should have). CGI::Application (like the docs say) uses $self->query() to retrieve an object (a CGI.pm object by default), which has a param() method that behaves like that of CGI.pm (that's all the object has to do). Now, CGI.pm has a method called "url_param", read about it in the "MIXING POST AND URL PARAMETERS" section of the CGI.pm manual. You can also read there how the param method behaves in different contexts (it is context sensitive). I leave you with a crucial snippet from CGI::Application
sub run { my $self = shift; my $q = $self->query(); my $rm_param = $self->mode_param() || croak("No rm_param() specifi +ed"); my $rm; # Support call-back instead of CGI mode param if (ref($rm_param) eq 'CODE') { # Get run-mode from subref $rm = $rm_param->($self); } else { # Get run-mode from CGI param $rm = $q->param($rm_param); # PodMaster: FYI - this is scala +r context } # If $rm undefined, use default (start) mode my $def_rm = $self->start_mode() || ''; $rm = $def_rm unless (defined($rm) && length($rm)); #...
You may also wanna read up on "mode_param()" in the CGI::Application docs. I hope this helps you see what's going on and solve your problem.

MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
** The third rule of perl club is a statement of fact: pod is sexy.

Replies are listed 'Best First'.
Re: Re: CGI::Application usage question
by freddo411 (Chaplain) on Aug 29, 2003 at 18:47 UTC
    Thanks for your socratic reply. I think I get the gist of it.

    The CGI::Application documentation has a nice example of a very similar problem to mine. In that case, instead of using submit buttons, the example uses links. These links contain the run mode and another name/value pair indicating other information in the query parameters. That would certainly be one way to solve this problem, but I don't want to use links, I prefer buttons.

    You also refer me to mode_param method which would allow me to choose a run mode based upon things other than something in the query string. I'm not sure how this helps my current problem.

    -------------------------------------
    Nothing is too wonderful to be true
    -- Michael Faraday