| 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
| |||||||||||||||||||
| 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; | |||||||||||||||||