Do you know where your variables are? | |
PerlMonks |
CGI::Application redirecting from one handler to another.by skx (Parson) |
on Jan 02, 2004 at 17:04 UTC ( [id://318353]=perlquestion: print w/replies, xml ) | Need Help?? |
skx has asked for the wisdom of the Perl Monks concerning the following question: I've just fallen in love with CGI::Application after diving into it for the first time. However I have one small problem concerning redirecting from one handler to another. I have an application where users may signup to have an account on the system, using CGI::Session to maintain the logged in state - and a table of usernames and passwords in a database. The way that I initialy handled this was to have a pair of handlers "join" which presented the signup page (via HTML::Template) and "create" which would be invoked as the result of the "join" page's form submissoin. This worked OK, but didn't give me a clean place to handle errors. So now I have a more complex system. The "join" method will present a signup form for the user to enter their username and password etc. The target of the form will be the join page itself - this allows me to catch errors early and output the form again with any errors such as "the two passwords you've given do not match", "username already used", etc. If the validation passes then I'd like to redirect to another handler - the create one - to actually create the account. I've successfully used code like this to jump from one handler to another:
For the signup this works well if I can tag on the extra details such as email and username - but it has the problem that the password is exposed. Now I have two solutions:
What should I be doing - right now I'm thinking that POSTing AND hashing is the correct thing to do, but I can't seem to get that to work. How do I make one CGI::Application handler redirect to another via a POST method?
Back to
Seekers of Perl Wisdom
|
|