MobileAgent/Request.pm

filter: Statementstmt 100% 17 / 17 Branchbran 100% 6 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 96.5% 28 / 29 SCAR 13.9
CC
4
Cov
100%
new
4.0
BEGIN
1.0
get
1.0
CRAP 4.0
« MobileAgent/EZweb.pm ↑ Summary MobileAgent/DoCoMoDisplayMap.pm »
1 package HTTP::MobileAgent::Request;
2 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 sub new {
5 575 ▶ my($class, $stuff) = @_;
Subroutine new: called CC=4 SCAR=13.9
Pod undocumented
6 575 ▶ if (!defined $stuff) {
Branch: 3 branches
BranchTrueFalseTotal
if (not defined $stuff) { } 526 49 575
elsif (UNIVERSAL::isa($stuff, 'Apache')) { } 1 48 49
elsif (UNIVERSAL::isa($stuff, 'HTTP::Headers')) { } 1 47 48
7 526 bless { env => \%ENV }, 'HTTP::MobileAgent::Request::Env';
8 }
9 elsif (UNIVERSAL::isa($stuff, 'Apache')) {
10 1 bless { r => $stuff }, 'HTTP::MobileAgent::Request::Apache';
11 }
12 elsif (UNIVERSAL::isa($stuff, 'HTTP::Headers')) {
13 1 bless { r => $stuff }, 'HTTP::MobileAgent::Request::HTTPHeaders';
14 }
15 else {
16 47 bless { env => { HTTP_USER_AGENT => $stuff } }, 'HTTP::MobileAgent::Request::Env';
17 }
18 }
19  
20 package HTTP::MobileAgent::Request::Env;
21  
22 sub get {
23 1535 ▶ my($self, $header) = @_;
Subroutine get: called CC=1 SCAR=0.0
24 1535 $header =~ tr/-/_/;
25 1535 return $self->{env}->{"HTTP_" . uc($header)};
26 }
27  
28 package HTTP::MobileAgent::Request::Apache;
29  
30 sub get {
31 3 ▶ my($self, $header) = @_;
Subroutine get: called CC=1 SCAR=0.0
32 3 return $self->{r}->header_in($header);
33 }
34  
35 package HTTP::MobileAgent::Request::HTTPHeaders;
36  
37 sub get {
38 3 ▶ my($self, $header) = @_;
Subroutine get: called CC=1 SCAR=0.0
39 3 return $self->{r}->header($header);
40 }
41  
42 10 1;
« MobileAgent/EZweb.pm ↑ Summary MobileAgent/DoCoMoDisplayMap.pm »