Greetings, nadarajan_v.

I'm not sure what your overall use of this is. But it might be worth looking at the pertinent RFC's HTTP status code(s). As I can never remember them, I took the liberty of creating a quick "cheat sheet". If your interested, here's the link to the pertinent section. I only mention it, because it is relevant to pass the correct status. ie;

#!/usr/bin/perl -w use strict; print "Status: 301 Moved Permanently\n"; print "Location: http://COMPLETE/URI\n\n"; # complete URI (not relative) is important for proxies/squid/and HTTP- +1.0 # Sending STATUS _first_ also matters exit;
You can also deliver CONTENT-TYPE on a conditional basis
#!/usr/bin/perl -Tw #accepts application/xhtml? if ($ENV{'HTTP_ACCEPT'} =~ /application\/xhtml\+xml/) { print "content-type:application/xhtml+xml; charset=utf-8\n\n"; } #no? then text/html they get else { print "content-type:text/html; charset=utf-8\n\n"; }
Wouldn't it be fun to boast of being XHTML compliant, even when your not?
if ($ENV{'HTTP_USER_AGENT'} =~ /W3C\_CSS\_Validator\_JFouffa/) { print "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n" +; print "<?xml-stylesheet href=\"w3c.css\" type=\"text\/css\" media= +\"screen, projection, print\" ?>\n"; print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1 plus MathML 2.0// +EN\" \"http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd\"> <html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">\n"; print "<head>\n"; my $server = $ENV{SERVER_NAME}; print " <title>"; print $server; print "</title>\n"; print " <meta http-equiv=\"content-type\" content=\"application\/xh +tml+xml; charset=utf-8\" />\n"; } else { print "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n" +; print "<?xml-stylesheet href=\"css3.css\" type=\"text\/css\" media +=\"screen, projection, print\" ?>\n"; print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1 plus MathML 2.0// +EN\" \"http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd\"> <html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">\n"; print "<head>\n"; my $server = $ENV{SERVER_NAME}; print " <title>"; print $server; print "</title>\n"; print " <meta http-equiv=\"content-type\" content=\"application\/xh +tml+xml; charset=utf-8\" />\n"; print " <link rel=\"stylesheet\" type=\"text/css\" href=\"css3.css\ +" media=\"screen, projection, print\" />\n"; }
Note the different stylesheet delivered, based on UA (User Agent).

FWIW INMHO CGI (cgi.pm) is evil, and should be avoided at all cost. The simplicity of it's use, and making your code appear clean, and tidy. Make it's usage very tempting. But it is my experience, that it abstracts one so far away from what they're doing, that over time, one can easily create code that encounters issues. Making it an unnecessary job to diagnose, and correct. In short; if you don't have to think about something long enough. You'll forget it -- hope that made sense to more than just me. :)

Best wishes.

Chris

#!/usr/bin/perl -Tw
use Perl::Always or die;
my $perl_version = (5.12.5);
print $perl_version;

In reply to Re: Redirection to one cgi page from another is not working by taint
in thread Redirection to one cgi page from another is not working by nadarajan_v

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.