MobileAgent/EZweb.pm

filter: Statementstmt 95.9% 47 / 49 Branchbran 100% 12 / 12 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 80.0% 8 / 10 Podpod 83.3% 5 / 6 totaltotal 91.4% 75 / 82 SCAR 20.8
CC
8
Cov
95%
is_tuka
4.0
parse
3.0
_make_display
2.0
CRAP 8.0
« MobileAgent.pm ↑ Summary MobileAgent/Request.pm »
1 package HTTP::MobileAgent::EZweb;
2  
3 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 10 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 10 $VERSION = 0.20;
6  
7 10 ▶use base qw(HTTP::MobileAgent);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 10 __PACKAGE__->make_accessors(
10 qw(version model device_id server xhtml_compliant comment)
11 );
12  
13 164 ▶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 6 ▶ my $self = shift;
Subroutine is_tuka: called CC=4 SCAR=13.9
Pod documented
21 6 my $tuka = substr($self->device_id, 2, 1);
22 6 ▶ if($self->is_wap2){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->is_wap2) { } 3 3 6
23 3 ▶ return 1 if $tuka eq 'U';
Branch: 1 branch
BranchTrueFalseTotal
if $tuka eq "U" 1 2 3
24 } else {
25 3 ▶ return 1 if $tuka eq 'T';
Branch: 1 branch
BranchTrueFalseTotal
if $tuka eq "T" 1 2 3
26 }
27 4 return;
28 }
29  
30 sub is_win {
31 6 ▶ my $self = shift;
Subroutine is_win: called CC=2 SCAR=6.9
Pod documented
32 6 my $win = substr($self->device_id, 2, 1);
33 6 ▶ $win eq '3' ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$win eq '3' ? : 1 5 6
34 }
35  
36 sub parse {
37 151 ▶ my $self = shift;
Subroutine parse: called CC=3 SCAR=11.0
Pod undocumented
38 151 my $ua = $self->user_agent;
39 151 ▶ if ($ua =~ s/^KDDI\-//) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ua =~ s/^KDDI\-//) { } 30 121 151
40 # KDDI-TS21 UP.Browser/6.0.2.276 (GUI) MMP/1.1
41 30 $self->{xhtml_compliant} = 1;
42 30 my($device, $browser, $opt, $server) = split / /, $ua, 4;
43 30 $self->{device_id} = $device;
44  
45 30 my($name, $version) = split m!/!, $browser;
46 30 $self->{name} = $name;
47 30 $self->{version} = "$version $opt";
48 30 $self->{server} = $server;
49 }
50 else {
51 # UP.Browser/3.01-HI01 UP.Link/3.4.5.2
52 121 my($browser, $server, $comment) = split / /, $ua, 3;
53 121 my($name, $software) = split m!/!, $browser;
54 121 $self->{name} = $name;
55 121 @{$self}{qw(version device_id)} = split /-/, $software;
56 121 $self->{server} = $server;
57 121 ▶ if ($comment) {
Branch: 1 branch
BranchTrueFalseTotal
if ($comment) 6 115 121
58 6 $comment =~ s/^\((.*)\)$/$1/;
59 6 $self->{comment} = $comment;
60 }
61 }
62 151 $self->{model} = $self->{device_id};
63 }
64  
65 sub _make_display {
66 2 ▶ my $self = shift;
Subroutine _make_display: called CC=2 SCAR=7.0
67 2 my($width, $height) = split /,/, $self->get_header('x-up-devcap-screenpixels');
68 2 my $depth = (split /,/, $self->get_header('x-up-devcap-screendepth'))[0];
69 2 my $color = $self->get_header('x-up-devcap-iscolor');
70 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
71 width => $width,
72 height => $height,
73 color => (defined $color && $color eq '1'),
74 depth => 2 ** $depth,
75 );
76 }
77  
78 10 1;
79 __END__
« MobileAgent.pm ↑ Summary MobileAgent/Request.pm »