NAME
Egg::Plugin::Response::Redirect - Output of redirect screen etc.
SYNOPSIS
use Egg qw/ Response::Redirect /;
__PACKAGE__->egg_startup(
plugin_redirect => {
default_url => '/',
default_wait => 0,
default_msg => 'Processing was completed.',
style => {
body => ' ..... ',
h1 => ' ..... ',
div => ' ..... ',
},
},
);
# redirect screen is output and processing is ended.
$e->redirect_body('/hoge_page', 'complete ok.', alert => 1 );
# The HTML source of redirect screen is acquired.
my $html= $e->redirect_body_source('/hoge_page', 'complete ok.', alert => 1 );
DESCRIPTION
It is a plugin that outputs the redirect screen.
CONFIGURATION
The configuration is done by 'plugin_redirect'.
plugin_redirect => {
........
...
},
default_url => [DEFAULT_URL]
When URL at the redirect destination is unspecification, it uses it.
Default is '/'.
default_wait => [WAIT_TIME]
When waiting time until redirecting is generated is unspecification, it uses it.
Default is '0',
default_msg => [REDIRECT_MESSAGE]
When redirect message is unspecification, it uses it.
Default is 'Processing was completed.'.
style => [HASH]
The screen style is set with HASH.
body => [BODY_STYLE]
The entire basic setting of screen.
Default:
background : #FFEDBB;
text-align : center;
h1 => [H1_STYLE]
Style of <h1>.
Default:
font : bold 20px sans-serif;
margin : 0px;
margin-left : 0px;'.
div => [DIV_STYLE]
Style of <div>.
Default:
background : #FFF7ED;
padding : 10px;
margin : 50px;
font : normal 12px sans-serif;
border : #D15C24 solid 3px;
text-align : left;
METHODS
redirect_body_source ( [URL], [MESSAGE], [OPTION_HASH] )
The HTML source of redirect screen is returned.
When URL is unspecification, 'default_url' of the configuration is used.
When MESSAGE is unspecification, 'defautl_msg' of the configuration is used.
The following options are accepted with OPTION_HASH.
wait => [WAIT_TIME]
Waiting time until redirecting is generated.
'default_wait' of the configuration is used at the unspecification.
$e->redirect_body_source(0, 0, wait => 1 );
alert => [BOOL]
When the screen is displayed, the alert of the JAVA script is generated.
MESSAGE is displayed in this alert.
$e->redirect_body_source(0, 0, alert => 1 );
onload_func => [ONLOAD_FUNCTION]
Onload is added to <body> when given.
$e->redirect_body_source(0, 0, onload_func => 'onload_script()' );
body_style => [STYLE]
style->{body} of the configuration is used when omitting it.
h1_style => [STYLE]
style->{h1} of the configuration is used when omitting it.
div_style => [STYLE]
style->{div} of the configuration is used when omitting it.
redirect_body ( [URL], [MESSAGE], [OPTION_HASH] )
$e->response->redirect is setup.
And, the return value of 'redirect_body_source' method is set in $e->response->body.
The argument extends to 'redirect_body_source' method as it is.
SEE ALSO
AUTHOR
Masatoshi Mizuno <lushe@cpan.org>
COPYRIGHT AND LICENSE
Copyright (C) 2008 Bee Flag, Corp. <http://egg.bomcity.com/>.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.