Amon2-MobileJP

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

Changes
LICENSE
META.json
README.md
cpanfile
lib/Amon2/MobileJP.pm
lib/Amon2/Plugin/Web/MobileAgent.pm
lib/Amon2/Plugin/Web/MobileCharset.pm
t/00_compile.t
t/01_mobile_agent.t
t/02_charset.t
xt/02_perlcritic.t
META.yml
MANIFEST

lib/Amon2/Plugin/Web/MobileCharset.pm  view on Meta::CPAN

use warnings;
use HTTP::MobileAgent::Plugin::Charset;
use Encode::JP::Mobile 0.29;
use Amon2::Util;

sub init {
    my ($class, $c, $conf) = @_;

    Amon2::Util::add_method($c, 'html_content_type' => sub {
        my $ma = shift->mobile_agent;
        my $ct  = $ma->is_docomo ? 'application/xhtml+xml;charset=' : 'text/html;charset=';
           $ct .= $ma->can_display_utf8 ? 'utf-8' : 'Shift_JIS';
           $ct;
    });

    Amon2::Util::add_method($c, 'encoding' => sub {
        shift->mobile_agent->encoding
    });
}

1;



( run in 0.254 second using v1.01-cache-2.11-cpan-4d50c553e7e )