Show
Ignore:
Timestamp:
12/12/07 09:54:13 (6 years ago)
Author:
tokuhirom
Message:

lang/perl/HTTP-MobileAgent?: trying to use WWW::MobileCarrierJP

Location:
lang/perl/HTTP-MobileAgent/branches/feature-WWWMobileCarrierJP
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/HTTP-MobileAgent/branches/feature-WWWMobileCarrierJP/Makefile.PL

    r204 r3079  
    66        'Test::More' => 0.32, 
    77        'HTTP::Headers' => 1.43, 
     8        'WWW::MobileCarrierJP' => 0.04, 
    89    }, 
    910); 
  • lang/perl/HTTP-MobileAgent/branches/feature-WWWMobileCarrierJP/bin/makedocomomap

    r2444 r3079  
    33use utf8; 
    44use FindBin; 
    5 use LWP::Simple; 
    65use Data::Dumper; 
    76use HTTP::MobileAgent; 
    87use Encode; 
    98use File::Spec; 
    10  
    11 my $URL = 
    12 'http://www.nttdocomo.co.jp/service/imode/make/content/spec/screen_area/index.html'; 
     9use WWW::MobileCarrierJP::DoCoMo::Display; 
    1310 
    1411do_task(@ARGV); 
    1512 
    1613sub do_task { 
    17     my $html = decode( 'cp932', get($URL) ); 
    18     $html =~ s/(?:\r?\n)+/\n/g; 
    19     $html =~ s/μ/myu/g; 
    20     my $re = regexp(); 
     14    my $dat = WWW::MobileCarrierJP::DoCoMo::Display->scrape; 
    2115    my %map; 
    22     while ( $html =~ /$re/igs ) { 
    23         my ( $model, $width, $height, $color, $depth ) = ( $1, $2, $3, $4, $5 ); 
    24         $map{ uc($model) } = { 
    25             width  => $width, 
    26             height => $height, 
    27             color  => $color eq 'カラー', 
    28             depth  => $depth, 
     16    for my $phone (@$dat) { 
     17        $map{ uc $phone->{model} } = +{ 
     18            width  => $phone->{width}, 
     19            height => $phone->{height}, 
     20            color  => $phone->{is_color}, 
     21            depth  => $phone->{depth}, 
    2922        }; 
    3023    } 
     
    8679} 
    8780 
    88 sub regexp { 
    89     return <<'RE'; 
    90 <td><span class="txt">([A-Z]+\d+\w*\+?).*?</span></td> 
    91 <td><span class="txt">.*?(?:</span></td>)? 
    92 <td><span class="txt">.*?(?:</span></td>)? 
    93 <td><span class="txt">.*?(\d+)×(\d+).*?</span></td> 
    94 <td>.*?</td> 
    95 <td><span class="txt">(白黒|カラー)(?:.*?)(\d+)(?:色|階調)</span></td> 
    96 RE 
    97 } 
  • lang/perl/HTTP-MobileAgent/branches/feature-WWWMobileCarrierJP/bin/makexmldocomomap

    r2444 r3079  
    33use warnings; 
    44use utf8; 
    5 use LWP::Simple; 
    65use XML::Simple (); 
    76use Encode; 
    8  
    9 my $URL = 
    10 'http://www.nttdocomo.co.jp/service/imode/make/content/spec/screen_area/index.html'; 
     7use WWW::MobileCarrierJP::DoCoMo::Display; 
    118 
    129do_task(@ARGV); 
    1310 
    1411sub do_task { 
    15     my $html = decode( 'cp932',  get($URL) ); 
    16     $html =~ s/(?:\r?\n)+/\n/g; 
    17     $html =~ s/&mu;/myu/g; 
    18     my $re = regexp(); 
     12    my $dat = WWW::MobileCarrierJP::DoCoMo::Display->scrape; 
    1913    my %map; 
    20     while ( $html =~ /$re/igs ) { 
    21         my ( $model, $width, $height, $color, $depth ) = ( $1, $2, $3, $4, $5 ); 
    22         push @{ $map{terminal} }, 
    23           { 
    24             model  => uc($model), 
    25             width  => $width, 
    26             height => $height, 
    27             color  => $color eq 'カラー', 
    28             depth  => $depth, 
    29           }; 
     14    for my $phone (@$dat) { 
     15        $map{ uc $phone->{model} } = +{ 
     16            width  => $phone->{width}, 
     17            height => $phone->{height}, 
     18            color  => $phone->{is_color}, 
     19            depth  => $phone->{depth}, 
     20        }; 
    3021    } 
    3122    output_code( \%map ); 
     
    4132} 
    4233 
    43 sub regexp { 
    44     return <<'RE'; 
    45 <td><span class="txt">([A-Z]+\d+\w*\+?).*?</span></td> 
    46 <td><span class="txt">.*?(?:</span></td>)? 
    47 <td><span class="txt">.*?(?:</span></td>)? 
    48 <td><span class="txt">.*?(\d+)×(\d+).*?</span></td> 
    49 <td>.*?</td> 
    50 <td><span class="txt">(白黒|カラー)(?:.*?)(\d+)(?:色|階調)</span></td> 
    51 RE 
    52 }