Changeset 12980

Show
Ignore:
Timestamp:
06/01/08 18:11:01 (5 years ago)
Author:
tokuhirom
Message:

bug fixed: Plugin::GPS.

Location:
lang/perl/mobirc/branches/plaggerize
Files:
1 added
1 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/mobirc/branches/plaggerize/lib/App/Mobirc/Plugin/GPS.pm

    r12910 r12980  
    1111use UNIVERSAL::require; 
    1212use String::TT ':all'; 
     13use Encode::JP::Mobile; 
     14 
     15has inv_geocoder => ( 
     16    is      => 'ro', 
     17    isa     => 'Str', 
     18    default => 'Null', 
     19); 
    1320 
    1421hook channel_page_option => sub { 
    15     my ($self, $global_context, $channel) = @_; 
     22    my ( $self, $global_context, $channel ) = @_; 
    1623 
    1724    my $time = time(); 
     
    2027 
    2128hook httpd => sub { 
    22     my ($self, $global_context, $c, $uri) = @_; 
     29    my ( $self, $global_context, $c, $uri ) = @_; 
    2330 
    24     if ($uri =~ m{^/channel/([^/]+)/gps$}) { 
     31    if ( $uri =~ m{^/channel/([^/]+)/gps$} ) { 
    2532        my $channel_name = $1; 
    2633 
    2734        my $config = App::Mobirc->context->config; 
    28         my $path = File::Spec->catfile($config->{global}->{assets_dir}, 'plugin', 'GPS', 'measure.tt2'); 
     35        my $path   = File::Spec->catfile( $config->{global}->{assets_dir}, 
     36            'plugin', 'GPS', 'measure.tt2' ); 
    2937 
    3038        local %ENV; 
    31         if (my $devcap_multimedia = $c->req->header('X-UP-DEVCAP-MULTIMEDIA')) { 
     39        if ( my $devcap_multimedia = $c->req->header('X-UP-DEVCAP-MULTIMEDIA') ) 
     40        { 
    3241            $ENV{HTTP_X_UP_DEVCAP_MULTIMEDIA} = $devcap_multimedia; 
    3342        } 
    3443 
    35         my $tt = Template->new(ABSOLUTE => 1); 
     44        my $tt = Template->new( ABSOLUTE => 1 ); 
    3645        $tt->process( 
    3746            $path, 
     
    4756        ) or warn $tt->error; 
    4857 
    49         $c->res->content_type(encode('utf8', 'text/html; charset=Shift_JIS')); 
     58        $c->res->content_type( 
     59            encode( 'utf8', 'text/html; charset=Shift_JIS' ) ); 
    5060        $c->res->body($out); 
    5161        return 1; 
    52     } else { 
     62    } 
     63    else { 
    5364        return 0; 
    5465    } 
     
    6071    if ($uri =~ m{^/channel/([^/]+)/gps_do$}) { 
    6172        my $channel_name = uri_unescape $1; 
    62         my $inv_geocoder = $conf->{inv_geocoder} || 'EkiData'; 
     73        my $inv_geocoder = $self->inv_geocoder; 
    6374 
    6475        my $point = $c->req->mobile_agent->get_location( $c->req->query_params ); 
     
    6677        "App::Mobirc::Plugin::GPS::InvGeocoder::$inv_geocoder"->use or die $@; 
    6778        my $msg = "App::Mobirc::Plugin::GPS::InvGeocoder::$inv_geocoder"->inv_geocoder($point); 
    68             $msg = uri_escape encode($c->req->mobile_agent->encoding, $msg); 
     79           $msg = uri_escape encode($c->req->mobile_agent->encoding, $msg); 
    6980 
    7081        my $time = time();