http://www.perlmonks.org?node_id=958999


in reply to Re: Web form to alter files is writing to file before submit button is pressed.
in thread Web form to alter files is writing to file before submit button is pressed.

aaron, so this checks all of the parameters I set, and if any of them are defined, then it will do stuff with the submitted form data. There may be one small problem with having to check all of those parameters which is some of my files will have tens of thousands of parameters to check. I am not overly worried about speed, but would that slow things down a little?

Have a cookie and a very nice day!
Lady Aleena
  • Comment on Re^2: Web form to alter files is writing to file before submit button is pressed.

Replies are listed 'Best First'.
Re^3: Web form to alter files is writing to file before submit button is pressed.
by aaron_baugher (Curate) on Mar 12, 2012 at 01:09 UTC

    That's not quite what it does. $cgi->param returns a list of the names of all the form fields submitted by the browser. So if any are submitted, it will return true, regardless of their values. Only when the URI is requested without any POST data -- as when the page is first loaded, typically -- will it return nothing, giving a false status to the if statement. So it's not really "checking all the parameters." To the extent that it loads them into some sort of structure, I'm fairly sure that was already done when you created the CGI object, so there's not much cost here.

    On your last question: If you have forms with that many fields, I think you'll run into bottlenecks at the browser or the web server -- with the maximum POST data size, for instance -- long before counting the items in a large array slows down your Perl script. With a form that large, I'd be more concerned about usability and maintainability than with speed.

    Aaron B.
    My Woefully Neglected Blog, where I occasionally mention Perl.