MobileAgent/EZweb.pm

filter: Statementstmt 95.5% 43 / 45 Branchbran 100% 10 / 10 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 77.7% 7 / 9 Podpod 80.0% 4 / 5 totaltotal 90.5% 67 / 74 CC 7 SCAR 9.0
CC
7
Cov
95%
is_tuka
4.0
parse
3.0
_make_display
2.0
CRAP 2.5
« MobileAgent/Request.pm ↑ Summary MobileAgent/AirHPhone.pm »
1 package HTTP::MobileAgent::EZweb;
2  
3 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 9 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 9 $VERSION = 0.19;
6  
7 9 ▶use base qw(HTTP::MobileAgent);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 9 __PACKAGE__->make_accessors(
10 qw(version model device_id server xhtml_compliant comment)
11 );
12  
13 161 ▶sub is_ezweb { 1 }
Subroutine is_ezweb: called CC=1 SCAR=0.0
Pod documented
14  
15 0 ▶sub carrier { 'E' }
Subroutine carrier: not called CC=1 SCAR=6.9
Pod documented
16  
17 0 ▶sub carrier_longname { 'EZweb' }
Subroutine carrier_longname: not called CC=1 SCAR=6.9
Pod documented
18  
19 sub is_tuka {
20 5 ▶ my $self = shift;
Subroutine is_tuka: called CC=4 SCAR=13.9
Pod documented
21 5 my $tuka = substr($self->device_id, 2, 1);
22 5 ▶ if($self->is_wap2){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->is_wap2) { } 2 3 5
23 2 ▶ return 1 if $tuka eq 'U';
Branch: 1 branch
BranchTrueFalseTotal
if $tuka eq "U" 1 1 2
24 } else {
25 3 ▶ return 1 if $tuka eq 'T';
Branch: 1 branch
BranchTrueFalseTotal
if $tuka eq "T" 1 2 3
26 }
27 }
28  
29 sub parse {
30 150 ▶ my $self = shift;
Subroutine parse: called CC=3 SCAR=11.0
Pod undocumented
31 150 my $ua = $self->user_agent;
32 150 ▶ if ($ua =~ s/^KDDI\-//) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ua =~ s/^KDDI\-//) { } 29 121 150
33 # KDDI-TS21 UP.Browser/6.0.2.276 (GUI) MMP/1.1
34 29 $self->{xhtml_compliant} = 1;
35 29 my($device, $browser, $opt, $server) = split / /, $ua, 4;
36 29 $self->{device_id} = $device;
37  
38 29 my($name, $version) = split m!/!, $browser;
39 29 $self->{name} = $name;
40 29 $self->{version} = "$version $opt";
41 29 $self->{server} = $server;
42 }
43 else {
44 # UP.Browser/3.01-HI01 UP.Link/3.4.5.2
45 121 my($browser, $server, $comment) = split / /, $ua, 3;
46 121 my($name, $software) = split m!/!, $browser;
47 121 $self->{name} = $name;
48 121 @{$self}{qw(version device_id)} = split /-/, $software;
49 121 $self->{server} = $server;
50 121 ▶ if ($comment) {
Branch: 1 branch
BranchTrueFalseTotal
if ($comment) 6 115 121
51 6 $comment =~ s/^\((.*)\)$/$1/;
52 6 $self->{comment} = $comment;
53 }
54 }
55 150 $self->{model} = $self->{device_id};
56 }
57  
58 sub _make_display {
59 2 ▶ my $self = shift;
Subroutine _make_display: called CC=2 SCAR=7.0
60 2 my($width, $height) = split /,/, $self->get_header('x-up-devcap-screenpixels');
61 2 my $depth = (split /,/, $self->get_header('x-up-devcap-screendepth'))[0];
62 2 my $color = $self->get_header('x-up-devcap-iscolor');
63 2 ▶ return HTTP::MobileAgent::Display->new(
Condition66%2/3
defined $color && $color eq '1'
!ll&&!rl&&r
011
MC/DC50%1/2
defined $color && $color eq '1'
defined $color $color eq '1'
Truth table66%2/3
A && B
A= defined $colorB= $color eq '1'
ABresult
0X0
100
111
64 width => $width,
65 height => $height,
66 color => (defined $color && $color eq '1'),
67 depth => 2 ** $depth,
68 );
69 }
70  
71 9 1;
72 __END__
« MobileAgent/Request.pm ↑ Summary MobileAgent/AirHPhone.pm »