chimni has asked for the wisdom of the Perl Monks concerning the following question:

Background

I have an html page with a form in it. I have done the client side validations in Java (e-mail, name, phone etc).

On submit I want to send the form data to an e-mail address and take the user to a html download page. I have made the download page using (html/css)

Is there a way of pasting my download page directly in perl? I already have the html code just want to paste it post server side data processing. But do not want to do this line by line OR I can use a header redirect as suggested in this thread and call the download form

any prefrence, is one way better? Thanks, Chi

Replies are listed 'Best First'.
Re: Form submission
by lostjimmy (Chaplain) on Mar 03, 2009 at 23:20 UTC
    Based on what you are saying, you have a few good options at your disposal:
    1. 1. Send a redirect header using the CGI module.
      use CGI qw/:standard/; send_mail(); print redirect('http://example.org/downloads.html');
    2. Use a templating solution, then after sending the email, process the downloads template
    3. or, since it seems to be static page, send the email, open the static downloads.html page, read it in and print it out to STDOUT.

      Thanks that help

      If i can read and print the html, cant i just paste it in the perl file. But when i do that and use here docs I get lots of errors - barword found , use of modifier meaningless etc

        I think we could help you best if you would supply both the relevant parts of the Perl script and the actually errors you receive (the one where you use the heredoc), and the HTML page you are trying to paste.

        If you'd rather keep it as a separate page, you should be able to do something like this:

        # do all your email stuff open $fh, "<", "downloads.html" or die; while ($fh) { print; } close $fh;
        Or you could slurp in the file and print it all at once, but either way it should work.