[tpm] (no subject)
sfryer at sourcery.ca
Wed Oct 17 14:23:03 PDT 2007
On Wed, Oct 17, 2007 at 09:04:35PM +0000, s z wrote:
> Hi, this is a newbie's question and I would like to get some advice from you:
> I am using perl to develop an application. I am able to read and write through ODBC to dbf files by using dbd-odbc. The script generates the html files for user interface like tables, input textboxes and submit buttons. when user enters new values into textboxes and press button to save, the form is submited and user's input is saved to the data file. This is done by calling a different perl script file. The screen goes blank afterwards. It would be nice to redisplay the input boxes and the buttons on the screen to let user to continue the editing. But how to call the perl display routine from another perl script? I am thinking to reuse the perl code from the previous routine in the update routine. Is there a better way to reuse the perl codes? How?
> Thanks a lot for your advice.
If the script which recieves the form submission does not output
any other data, you might consider sending an HTTP redirect back
to the first script. There are a number of ways to do this, but
perhaps the very simplest (and for which I'll likely get flamed)
is to print the following line (assuming your webserver doesn't
do headers for you automatically).
print "Location: http://domain.tld/path/to/your/first.cgi\n\n";
You can do this either before or after your database call,
depending on the speed of the application and whether or not you
might need to output an error to the user in case of problems.
If you are using the CGI module or another variant such as
Apache::whatever, then you should read the API docs for info on
how to do this.
More information about the toronto-pm