CGI::Header::Redirect - Adapter for CGI::redirect() function
use CGI::Header::Redirect; my $header = CGI::Header::Redirect->new( -uri => 'http://somewhere.else/in/movie/land', -nph => 1, -status => '301 Moved Permanently', );
CGI::Header::Redirect is a subclass of CGI::Header.
uri and url are the alias of location.
uri
url
location
CGI::Header::Redirect->get_alias('uri'); # => 'location' CGI::Header::Redirect->get_alias('url'); # => 'location'
A shortcut for:
my $h = CGI::Header::Redirect->new({ -location => $url });
Unlike CGI::Header objects, you cannot clear() your CGI::Header::Redirect object completely. The Location header always exists.
clear()
$header->clear; # warn "Can't delete the Location header"
Always returns false.
$header->query->redirect( $header->header );
You can't delete the Location header. The header field always exists.
# wrong $header->set( 'Location' => q{} ); $header->set( 'Location' => undef ); $header->delete('Location'); if ( $header->exists('Location') ) { # always true ... }
You can set the Status header to neither undef nor an empty string:
undef
# wrong $header->set( 'Status' => undef ); $header->set( 'Status' => q{} );
Use delete() instead:
delete()
$header->delete('Status');
CGI, CGI::Header
Ryo Anazawa (anazawa@cpan.org)
This module is free software; you can redistibute it and/or modify it under the same terms as Perl itself. See perlartistic.
To install CGI::Header, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CGI::Header
CPAN shell
perl -MCPAN -e shell install CGI::Header
For more information on module installation, please visit the detailed CPAN module installation guide.