=encodeing euc-jp

=head1 Name

CGI::Application::Plugin::Eparam::Nihongo

=head1 SYNOPSIS

    package WebApp
    use Jcode;# この他 use Encode するか、自前で $CGI::Application::Plugin::Eparam::econv = sub { ... } と、変換ロジックを実装する
    use CGI::Application::Plugin::Eparam;
    sub cgiapp_init {
            $CGI::Application::Plugin::Eparam::icode = 'sjis';   # 入力される文字コード
            $CGI::Application::Plugin::Eparam::ocode = 'euc-jp'; # 変換したい文字コード
    }
    package WebApp::Pages::Public
    sub page1 {
            my $self = shift;
            my $data = $self->eparam('data');               # 変換後の値
            my $natural_data = $self->query->param('data'); # 変換前の値
    }

=head1 Example

=head2 Get Value

    package WebApp::Pages::Public
    sub page1 {
            my $self = shift;
            my $data = $self->eparam('data');
            my $natural_data = $self->query->param('data');
    }

=head2 in Application

    package WebApp
    use Jcode;
    use CGI::Application::Plugin::Eparam;
    sub cgiapp_init {
            $CGI::Application::Plugin::Eparam::icode = 'sjis';
            $CGI::Application::Plugin::Eparam::ocode = 'euc-jp';
    }

=head2 in SubClass

    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';
    }

=head2 in Method

    package WebApp::Pages::User::Mailform
    sub mailform {

            # この場合変換は行われません
            $CGI::Application::Plugin::Eparam::icode = 'jis';
            $CGI::Application::Plugin::Eparam::ocode = 'jis';

            # メールの件名にしたい部分だけをjisで得るような事が出来ます
            $CGI::Application::Plugin::Eparam::icode = 'sjis';
            $CGI::Application::Plugin::Eparam::ocode = 'jis';

    }

=head2 in Part

    package Myapplication::Pages::User::Mailform
    sub mailform {

            # 一時的に設定を変更する事が出来ます
            $CGI::Application::Plugin::Eparam::temp_icode = 'sjis';
            $CGI::Application::Plugin::Eparam::temp_ocode = 'jis';
            my $val_jis = $self->eparam('val');
            # undefで元に戻せます
            undef $CGI::Application::Plugin::Eparam::temp_icode;
            undef $CGI::Application::Plugin::Eparam::temp_ocode;
            my $val_sjis = $self->eparam('val');

    }

=head2 Convert Logic Customize

    # 自分で変換ロジックを組む事が出来ます
    $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);
    };
    # temp_を使うと一時的なものになります
    $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);
    };
    # undefで元に戻します
    undef $CGI::Application::Plugin::Eparam::temp_econv;

=head1 SEE ALSO

L<CGI::Application>

=head1 AUTHOR

Shinichiro Aska

=cut
