Changeset 19888
- Timestamp:
- 09/25/08 11:16:41 (5 years ago)
- Location:
- lang/perl/App-Hachero/trunk
- Files:
-
- 6 modified
-
Makefile.PL (modified) (1 diff)
-
lib/App/Hachero/Plugin/Analyze/UserAgent.pm (modified) (2 diffs)
-
lib/App/Hachero/Plugin/Classify/UserAgent.pm (modified) (2 diffs)
-
lib/App/Hachero/Plugin/Parse/Normalize.pm (modified) (2 diffs)
-
t/plugin/analyze/03_useragent.t (modified) (1 diff)
-
t/plugin/classify/03_useragent.t (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/App-Hachero/trunk/Makefile.PL
r19876 r19888 23 23 requires 'IO::All'; 24 24 requires 'Module::Collect'; 25 requires 'HTTP:: BrowserDetect';25 requires 'HTTP::DetectUserAgent'; 26 26 requires 'File::Find::Rule::Age'; 27 27 requires 'Template'; -
lang/perl/App-Hachero/trunk/lib/App/Hachero/Plugin/Analyze/UserAgent.pm
r19768 r19888 11 11 my $req = $context->currentinfo->{request} or return; 12 12 my $browser = $context->currentinfo->{useragent} or return; 13 my $browser_string = $browser-> browser_string || '';13 my $browser_string = $browser->name || 'Unknown'; 14 14 my $truncate = $self->config->{config}->{truncate_to} || 'hour'; 15 15 my $time = $req->{datetime}->clone->truncate(to => $truncate); … … 17 17 18 18 $context->result->{UserAgent} ||= App::Hachero::Result::UserAgent->new; 19 20 19 $context->result->{UserAgent}->push( 21 20 { -
lang/perl/App-Hachero/trunk/lib/App/Hachero/Plugin/Classify/UserAgent.pm
r19499 r19888 3 3 use warnings; 4 4 use base qw(App::Hachero::Plugin::Base); 5 use HTTP:: BrowserDetect;5 use HTTP::DetectUserAgent; 6 6 7 7 sub init { … … 12 12 my ($self, $context, $args) = @_; 13 13 my $ua = $context->currentlog->{ua} or return; 14 my $browser = HTTP:: BrowserDetect->new($ua);14 my $browser = HTTP::DetectUserAgent->new($ua); 15 15 $context->currentinfo->{useragent} = $browser; 16 16 } -
lang/perl/App-Hachero/trunk/lib/App/Hachero/Plugin/Parse/Normalize.pm
r18806 r19888 5 5 use DateTime::Format::HTTP; 6 6 use URI; 7 use URI::QueryParam; 7 8 8 9 sub parse : Hook { … … 19 20 $info->{request} = { 20 21 method => $req[0], 21 uri => URI->new($req[1] ),22 uri => URI->new($req[1], 'http'), 22 23 protocol => $req[2] || 'HTTP/0.9', 23 24 datetime => $datetime, -
lang/perl/App-Hachero/trunk/t/plugin/analyze/03_useragent.t
r19768 r19888 61 61 --- expected 62 62 datetime: '2008-08-07 00:00:00' 63 useragent: ' MSIE'63 useragent: 'Internet Explorer' 64 64 count: 1 65 65 -
lang/perl/App-Hachero/trunk/t/plugin/classify/03_useragent.t
r19768 r19888 23 23 $app->currentinfo( {} ); 24 24 $app->run_hook('classify'); 25 is $app->currentinfo->{useragent}-> browser_string, $block->expected;25 is $app->currentinfo->{useragent}->name, $block->expected; 26 26 } 27 27 … … 31 31 ua: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322) 32 32 --- expected 33 MSIE 33 Internet Explorer 34 34 35 35 === Firefox
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)