blue_cowdawg has asked for the wisdom of the Perl Monks concerning the following question:

Monks,

I must confess: I wasn't sure if this should go under SOPW, PD or Meditations, but here it is anyway.

In writing a web application (for my wife of all people) to manage a list of contacts for a dog club that I belong to. The technique that I use in designing my web applications in Perl is to use a central script that dispatches to various OO modules that contain the functionality I am after. A CGI parameter that gets carried between executions of the central script is a parmeter called "Action" that tells the central script what to do next.

Often times I use hidden fields to carry the value of Action and other times I use submit buttons to "jam" the value.

While debugging my application I got into a situation where the next action was not being executed. I started to dig into it and discovered something wierd. Here is a sniglet of the code that I was using:

A simplified version of the resultant HTML looked like: <form ... blah blah...>
<hidden name="Action" value="lastAction"/> <submit name="Action" value="insertNext">
</form>

Now: what I want to know is was I smoking too much crack that day or has anybody else seen this sort of odd behavior.

I was able to fix the issue but invoking $cgi->delete_all prior to building the new form.


Peter @ Berghold . Net

Sieze the cow! Bite the day!

Test the code? We don't need to test no stinkin' code! All code posted here is as is where is unless otherwise stated.

Brewer of Belgian style Ales

Replies are listed 'Best First'.
Re: Odd CGI.pm behavior.
by Zaxo (Archbishop) on Aug 07, 2003 at 02:00 UTC

    I think that CGI.pm's sticky data is causing that. If that is the case, you can modify the CGI object to rename or remove the conflicting hidden field before printing the form.

    After Compline,
    Zaxo

Re: Odd CGI.pm behavior.
by diotalevi (Canon) on Aug 07, 2003 at 03:28 UTC

    Have you ever seen CGI::Application? I read your description and I get the impression you're just re-implementing that. Why not save the effort and less Jesse do your work for you?