Egg::Plugin::Response::Redirect - Output of redirect screen etc.
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 );
It is a plugin that outputs the redirect screen.
The configuration is done by 'plugin_redirect'.
plugin_redirect => { ........ ... },
When URL at the redirect destination is unspecification, it uses it.
Default is '/'.
When waiting time until redirecting is generated is unspecification, it uses it.
Default is '0',
When redirect message is unspecification, it uses it.
Default is 'Processing was completed.'.
The screen style is set with HASH.
The entire basic setting of screen.
Default: background : #FFEDBB; text-align : center;
Style of <h1>.
Default: font : bold 20px sans-serif; margin : 0px; margin-left : 0px;'.
Style of <div>.
Default: background : #FFF7ED; padding : 10px; margin : 50px; font : normal 12px sans-serif; border : #D15C24 solid 3px; text-align : left;
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.
Waiting time until redirecting is generated.
'default_wait' of the configuration is used at the unspecification.
$e->redirect_body_source(0, 0, wait => 1 );
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 is added to <body> when given.
$e->redirect_body_source(0, 0, onload_func => 'onload_script()' );
style->{body} of the configuration is used when omitting it.
style->{h1} of the configuration is used when omitting it.
style->{div} of the configuration is used when omitting it.
$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.
Egg::Release, Egg::Response,
Masatoshi Mizuno <lushe@cpan.org>
Copyright (C) 2008 Bee Flag, Corp. <http://egg.bomcity.com/>, All Rights Reserved.
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.
To install Egg::Release, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Egg::Release
CPAN shell
perl -MCPAN -e shell install Egg::Release
For more information on module installation, please visit the detailed CPAN module installation guide.