Changeset 19888

Show
Ignore:
Timestamp:
09/25/08 11:16:41 (5 years ago)
Author:
mizuno_takaaki
Message:

lang/perl/App-Hachero: modified to use HTTP::DetectUserAgent?

Location:
lang/perl/App-Hachero/trunk
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/App-Hachero/trunk/Makefile.PL

    r19876 r19888  
    2323requires 'IO::All'; 
    2424requires 'Module::Collect'; 
    25 requires 'HTTP::BrowserDetect'; 
     25requires 'HTTP::DetectUserAgent'; 
    2626requires 'File::Find::Rule::Age'; 
    2727requires 'Template'; 
  • lang/perl/App-Hachero/trunk/lib/App/Hachero/Plugin/Analyze/UserAgent.pm

    r19768 r19888  
    1111    my $req = $context->currentinfo->{request} or return; 
    1212    my $browser = $context->currentinfo->{useragent} or return; 
    13     my $browser_string = $browser->browser_string || ''; 
     13    my $browser_string = $browser->name || 'Unknown'; 
    1414    my $truncate = $self->config->{config}->{truncate_to} || 'hour'; 
    1515    my $time = $req->{datetime}->clone->truncate(to => $truncate); 
     
    1717 
    1818    $context->result->{UserAgent} ||= App::Hachero::Result::UserAgent->new; 
    19      
    2019    $context->result->{UserAgent}->push( 
    2120        { 
  • lang/perl/App-Hachero/trunk/lib/App/Hachero/Plugin/Classify/UserAgent.pm

    r19499 r19888  
    33use warnings; 
    44use base qw(App::Hachero::Plugin::Base); 
    5 use HTTP::BrowserDetect; 
     5use HTTP::DetectUserAgent; 
    66 
    77sub init { 
     
    1212    my ($self, $context, $args) = @_; 
    1313    my $ua = $context->currentlog->{ua} or return; 
    14     my $browser = HTTP::BrowserDetect->new($ua); 
     14    my $browser = HTTP::DetectUserAgent->new($ua); 
    1515    $context->currentinfo->{useragent} = $browser; 
    1616} 
  • lang/perl/App-Hachero/trunk/lib/App/Hachero/Plugin/Parse/Normalize.pm

    r18806 r19888  
    55use DateTime::Format::HTTP; 
    66use URI; 
     7use URI::QueryParam; 
    78 
    89sub parse : Hook { 
     
    1920    $info->{request} = { 
    2021        method   => $req[0], 
    21         uri      => URI->new($req[1]), 
     22        uri      => URI->new($req[1], 'http'), 
    2223        protocol => $req[2] || 'HTTP/0.9', 
    2324        datetime => $datetime, 
  • lang/perl/App-Hachero/trunk/t/plugin/analyze/03_useragent.t

    r19768 r19888  
    6161--- expected 
    6262datetime: '2008-08-07 00:00:00' 
    63 useragent: 'MSIE' 
     63useragent: 'Internet Explorer' 
    6464count: 1 
    6565 
  • lang/perl/App-Hachero/trunk/t/plugin/classify/03_useragent.t

    r19768 r19888  
    2323    $app->currentinfo( {} ); 
    2424    $app->run_hook('classify'); 
    25     is $app->currentinfo->{useragent}->browser_string, $block->expected; 
     25    is $app->currentinfo->{useragent}->name, $block->expected; 
    2626} 
    2727 
     
    3131ua: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322) 
    3232--- expected 
    33 MSIE 
     33Internet Explorer 
    3434 
    3535=== Firefox