File Coverage

blib/lib/HTTP/MobileAttribute/Agent/EZweb.pm
Criterion Covered Total %
statement 28 28 100.0
branch 4 4 100.0
condition n/a
subroutine 4 4 100.0
pod 0 1 0.0
total 36 37 97.3


line stmt bran cond sub pod time code
1             package HTTP::MobileAttribute::Agent::EZweb;
2 26     26   158 use strict;
  26         61  
  26         1126  
3 26     26   147 use warnings;
  26         51  
  26         744  
4 26     26   147 use HTTP::MobileAttribute::Agent::Base;
  26         56  
  26         209  
5              
6             __PACKAGE__->mk_accessors(qw/name version model device_id server comment/);
7              
8             sub parse {
9 184     184 0 332 my ( $self, ) = @_;
10              
11 184         561 my $ua = $self->user_agent;
12 184 100       703 if ( $ua =~ s/^KDDI\-// ) {
13             # KDDI-TS21 UP.Browser/6.0.2.276 (GUI) MMP/1.1
14 58         248 my ( $device, $browser, $opt, $server ) = split / /, $ua, 4;
15 58         167 $self->{device_id} = $device;
16              
17 58         188 my ( $name, $version ) = split m!/!, $browser;
18 58         223 $self->{name} = $name;
19 58         202 $self->{version} = "$version $opt";
20 58         138 $self->{server} = $server;
21             }
22             else {
23             # UP.Browser/3.01-HI01 UP.Link/3.4.5.2
24 126         399 my ( $browser, $server, $selfomment ) = split / /, $ua, 3;
25 126         286 my ( $name, $software ) = split m!/!, $browser;
26 126         213 $self->{name} = $name;
27 126         243 @{$self}{qw(version device_id)} = split /-/, $software;
  126         368  
28 126         258 $self->{server} = $server;
29 126 100       338 if ($selfomment) {
30 6         45 $selfomment =~ s/^\((.*)\)$/$1/;
31 6         18 $self->{comment} = $selfomment;
32             }
33             }
34 184         600 $self->{model} = $self->{device_id};
35             }
36              
37              
38             1;