NAME

CGI::Header::Redirect - Adapter for CGI::redirect() function

SYNOPSIS

use CGI::Header::Redirect;

my $header = CGI::Header::Redirect->new(
    -uri    => 'http://somewhere.else/in/movie/land',
    -nph    => 1,
    -status => '301 Moved Permanently',
);

DESCRIPTION

INHERITANCE

CGI::Header::Redirect is a subclass of CGI::Header.

OVERRIDDEN METHODS

$alias = CGI::Header::Redirect->get_alias( $prop )

uri and url are the alias of location.

CGI::Header::Redirect->get_alias('uri'); # => 'location'
CGI::Header::Redirect->get_alias('url'); # => 'location'
$header = CGI::Header::Redirect->new( $url )

A shortcut for:

my $h = CGI::Header::Redirect->new({ -location => $url });
$self = $header->clear

Unlike CGI::Header objects, you cannot clear() your CGI::Header::Redirect object completely. The Location header always exists.

$header->clear; # warn "Can't delete the Location header"
$bool = $header->is_empty

Always returns false.

$header->as_string

A shortcut for:

$header->query->redirect( $header->header );

LIMITATIONS

Location

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
    ...
}
Status

You can set the Status header to neither undef nor an empty string:

# wrong
$header->set( 'Status' => undef );
$header->set( 'Status' => q{} );

Use delete() instead:

$header->delete('Status');

SEE ALSO

CGI, CGI::Header

AUTHOR

Ryo Anazawa (anazawa@cpan.org)

LICENSE

This module is free software; you can redistibute it and/or modify it under the same terms as Perl itself. See perlartistic.