CGI::Application::Plugin::Eparam
package WebApp use Jcode;# or use Encode or $CGI::Application::Plugin::Eparam::econv = sub { ... } use CGI::Application::Plugin::Eparam; sub cgiapp_init { $CGI::Application::Plugin::Eparam::icode = 'sjis'; # input code $CGI::Application::Plugin::Eparam::ocode = 'euc-jp'; # want code } package WebApp::Pages::Public sub page1 { my $self = shift; my $data = $self->eparam('data'); # convert data my $natural_data = $self->query->param('data'); # data }
package WebApp::Pages::Public sub page1 { my $self = shift; my $data = $self->eparam('data'); # convert data my $natural_data = $self->query->param('data'); # data }
package WebApp use Jcode;# or use Encode or $CGI::Application::Plugin::Eparam::econv = sub { ... } use CGI::Application::Plugin::Eparam; sub cgiapp_init { $CGI::Application::Plugin::Eparam::icode = 'sjis'; # input code $CGI::Application::Plugin::Eparam::ocode = 'euc-jp'; # want code }
package WebApp::Pages::Public sub setup { $CGI::Application::Plugin::Eparam::icode = 'sjis'; $CGI::Application::Plugin::Eparam::ocode = 'euc-jp'; } package WebApp::Pages::Admin sub setup { $CGI::Application::Plugin::Eparam::icode = 'euc-jp'; $CGI::Application::Plugin::Eparam::ocode = 'euc-jp'; }
package WebApp::Pages::User::Mailform sub mailform { # this case is no convert $CGI::Application::Plugin::Eparam::icode = 'jis'; $CGI::Application::Plugin::Eparam::ocode = 'jis'; # The thing used for the character-code conversion before Mail Sending can be done. $CGI::Application::Plugin::Eparam::icode = 'sjis'; $CGI::Application::Plugin::Eparam::ocode = 'jis'; }
package Myapplication::Pages::User::Mailform sub mailform { # temp_ocode are given to priority more than ocode. $CGI::Application::Plugin::Eparam::temp_icode = 'sjis'; $CGI::Application::Plugin::Eparam::temp_ocode = 'jis'; my $val_jis = $self->eparam('val'); # It returns it. undef $CGI::Application::Plugin::Eparam::temp_icode; undef $CGI::Application::Plugin::Eparam::temp_ocode; my $val_sjis = $self->eparam('val'); }
# It is very effective. $CGI::Application::Plugin::Eparam::econv = sub { my $textref = shift; my $ocode = shift; # output character code my $icode = shift; # input character code # some logic Encode::from_to($$textref, 'Guess', $ocode); }; # It is temporarily effective. $CGI::Application::Plugin::Eparam::temp_econv = sub { my $textref = shift; my $ocode = shift; # output character code my $icode = shift; # input character code # some logic Encode::from_to($$textref, 'Guess', $ocode); }; # It returns to the processing of the standard. undef $CGI::Application::Plugin::Eparam::temp_econv;
CGI::Application
Shinichiro Aska
To install CGI::Application::Plugin::Eparam, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CGI::Application::Plugin::Eparam
CPAN shell
perl -MCPAN -e shell install CGI::Application::Plugin::Eparam
For more information on module installation, please visit the detailed CPAN module installation guide.