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:

my $redirect_url=$this_url.'?node=viewprofile;username='.$user; $self->header_type('redirect'); $self->header_props(-url => $redirect_url); return;

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?

Steve
---
steve.org.uk

In reply to CGI::Application redirecting from one handler to another. by skx

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.