|Problems? Is your data what you think it is?|
LWP Redirection Problemby davorg (Chancellor)
|on Sep 02, 2002 at 10:21 UTC||Need Help??|
davorg has asked for the wisdom of the Perl Monks concerning the following question:
I'm having some problems with some LWP that I'd appreciate some help with. I'll describe the problem, my proposed solution and what's wrong with my solution.
I'm collecting data from a form and passing it on to a third party CGI program. The data inputs on the form are determined by what is sensible to give the user. The data passed on to the CGI program is determined by the owners of the program.
These two sets of requirements are at odds with each other.
For example, I'm giving customers a choice of paying £x/month or £y/year. This is obviously going to be controlled by one input (either a select with two options or a pair of radio buttons). It makes no sense to have one input for "amount" and another for "period". Unfortunately this is exactly what the CGI program expects.
So my problem is that I need to send a different set of CGI parameters to the ones that are on the form.
So I thought I'd write another CGI program that sits between the form and the third-party CGI program. My program would look at the incoming parameters, calculate any extra parameters needed (e.g. create an "amount" parameter based on the value in the "period" parameter), and then make a POST request to the external CGI program. It then need to display the results it gets back in the browser.
Here's roughly what I've got.
This pretty much does what I want, but there are a couple of problems.
It seems to me that what I really want is a "redirect", but you can't redirect a POST request (or can you?)
Are there any other suggestions? Am I missing something obvious?--
"The first rule of Perl club is you do not talk about