File Coverage

blib/lib/HTTP/MobileAgent/EZweb.pm
Criterion Covered Total %
statement 40 42 95.2
branch 10 10 100.0
condition 2 3 66.6
subroutine 7 9 77.7
pod 4 5 80.0
total 63 69 91.3


line stmt bran cond sub pod time code
1             package HTTP::MobileAgent::EZweb;
2              
3 9     9   38 use strict;
  9         13  
  9         330  
4 9     9   41 use vars qw($VERSION);
  9         12  
  9         561  
5             $VERSION = 0.19;
6              
7 9     9   45 use base qw(HTTP::MobileAgent);
  9         10  
  9         5002  
8              
9             __PACKAGE__->make_accessors(
10             qw(version model device_id server xhtml_compliant comment)
11             );
12              
13 161     161 1 648 sub is_ezweb { 1 }
14              
15 0     0 1 0 sub carrier { 'E' }
16              
17 0     0 1 0 sub carrier_longname { 'EZweb' }
18              
19             sub is_tuka {
20 5     5 1 9 my $self = shift;
21 5         15 my $tuka = substr($self->device_id, 2, 1);
22 5 100       14 if($self->is_wap2){
23 2 100       11 return 1 if $tuka eq 'U';
24             } else {
25 3 100       15 return 1 if $tuka eq 'T';
26             }
27             }
28              
29             sub parse {
30 150     150 0 188 my $self = shift;
31 150         343 my $ua = $self->user_agent;
32 150 100       481 if ($ua =~ s/^KDDI\-//) {
33             # KDDI-TS21 UP.Browser/6.0.2.276 (GUI) MMP/1.1
34 29         82 $self->{xhtml_compliant} = 1;
35 29         98 my($device, $browser, $opt, $server) = split / /, $ua, 4;
36 29         59 $self->{device_id} = $device;
37              
38 29         55 my($name, $version) = split m!/!, $browser;
39 29         43 $self->{name} = $name;
40 29         48 $self->{version} = "$version $opt";
41 29         50 $self->{server} = $server;
42             }
43             else {
44             # UP.Browser/3.01-HI01 UP.Link/3.4.5.2
45 121         379 my($browser, $server, $comment) = split / /, $ua, 3;
46 121         259 my($name, $software) = split m!/!, $browser;
47 121         219 $self->{name} = $name;
48 121         247 @{$self}{qw(version device_id)} = split /-/, $software;
  121         345  
49 121         213 $self->{server} = $server;
50 121 100       289 if ($comment) {
51 6         39 $comment =~ s/^\((.*)\)$/$1/;
52 6         20 $self->{comment} = $comment;
53             }
54             }
55 150         389 $self->{model} = $self->{device_id};
56             }
57              
58             sub _make_display {
59 2     2   3 my $self = shift;
60 2         4 my($width, $height) = split /,/, $self->get_header('x-up-devcap-screenpixels');
61 2         5 my $depth = (split /,/, $self->get_header('x-up-devcap-screendepth'))[0];
62 2         5 my $color = $self->get_header('x-up-devcap-iscolor');
63 2   66     16 return HTTP::MobileAgent::Display->new(
64             width => $width,
65             height => $height,
66             color => (defined $color && $color eq '1'),
67             depth => 2 ** $depth,
68             );
69             }
70              
71             1;
72             __END__