in reply to Re: Re: Problem with form submission and redirect
in thread Problem with form submission and redirect

Well, compare
print "Content-type: text/html\n\n"; print "<html>\n"; print "<head>\n"; print "<META http-equiv=\"refresh\" content=\"0; url=http://mail.$ +domain/cgi-bin/qmailadmin\">\n"; print "</head>\n"; print "</html>\n";
with
print <<REDIRECT; Content-type: text/html <html> <head> <META http-equiv="refresh" content="0; url=http://mail.$domain/cgi-bin +/qmailadmin> </head> </html> REDIRECT

I would say that the second one is more readable and more maintainable. And be sure to read merlyn's strong suggestion to use CGI.pm for this particular application, instead of the code above.

--t. alex
but my friends call me T.

Replies are listed 'Best First'.
Re: Re (3): Problem with form submission and redirect
by Anonymous Monk on Aug 26, 2002 at 23:05 UTC
    Use CGI redirect for cleaner code. print "Location: /mail.$domain/cgi-bin/qmailadmin\n\n"; See Merlyn's post (Randal Schwartz) above. Rather than either example below shown previously. print "Content-type: text/html\n\n"; print "<html>\n"; print "<head>\n"; print "<META http-equiv=\"refresh\" content=\"0; url=http://mail.$ +domain/cgi-bin/qmailadmin\">\n"; print "</head>\n"; print "</html>\n"; print <<REDIRECT; Content-type: text/html <html> <head> <META http-equiv="refresh" content="0; url=http://mail.$domain/cgi-bin +/qmailadmin> </head> </html> REDIRECT
Re: Re (3): Problem with form submission and redirect
by Anonymous Monk on May 10, 2013 at 06:37 UTC
    Just an observation, from a lowly peasant :) HEREDOCS seem to break up the flow when indentation is thrown in the mix..
    Compare NORMAL with a bit of creative indentation ------ sub level1{ if ($level2){ print "Content-type: text/html \n\n". "<html> \n". "<head> \n". "<META http-equiv=\"refresh\" "content=\"0; ". "url=http://mail.$+domain/cgi-bin/qmailadmin\"> \n". "</head> \n". "</html> \n"; } } with HEREDOC ------- sub level1{ if($level2){ print <<REDIRECT; Content-type: text/html <html> <head> <META http-equiv="refresh" content="0; url=http://mail.$domain/cgi-bin +/qmailadmin> </head> </html> REDIRECT } }