[Cascavel-pm] [Spam] Re: redirect
Andre Ferraz
deferraz em terra.com.br
Sábado Março 25 15:57:38 PST 2006
Opa !
André Garcia Carneiro wrote:
>Claro, desculpe!
>
>Simples assim:
>
>.
>.
>.
>print $cgi->header;
>print "<head>";
>print "<META http-equiv='refresh' content='4; URL=http://endereco.com.br/scriptdir/script.pl'>";
>print "</head>";
>
>
Retirado do pod do modulo CGI.pm:
GENERATING A REDIRECTION HEADER
print $query->redirect('http://somewhere.else/in/movie/land');
Sometimes you don't want to produce a document yourself, but simply
redirect the browser elsewhere, perhaps choosing a URL based on the
time of day or the identity of the user.
The redirect() function redirects the browser to a different URL. If
you use redirection like this, you should not print out a header as
well.
One hint I can offer is that relative links may not work
correctly when
you generate a redirection to another document on your site. This is
due to a well-intentioned optimization that some servers use. The
solution to this is to use the full URL (including the http: part) of
the document you are redirecting to.
You can also use named arguments:
print
$query->redirect(-uri=>'http://somewhere.else/in/movie/land',
-nph=>1);
The -nph parameter, if set to a true value, will issue the correct
headers to work with a NPH (no-parse-header) script. This is
important
to use with certain servers, such as Microsoft IIS, which expect all
their scripts to be NPH.
-------------------------------
IMHO eh um modo de escrever a mesma coisa com menos instrucoes nao
perdendo a legibilidade do codigo...
[]s
Mais detalhes sobre a lista de discussão Cascavel-pm