File Coverage

blib/lib/HTTP/MobileAttribute/Request/Env.pm
Criterion Covered Total %
statement 12 12 100.0
branch 2 2 100.0
condition n/a
subroutine 4 4 100.0
pod 0 2 0.0
total 18 20 90.0


line stmt bran cond sub pod time code
1             package HTTP::MobileAttribute::Request::Env;
2 28     28   166 use strict;
  28         65  
  28         1093  
3 28     28   3768 use warnings;
  28         61  
  28         4571  
4              
5             sub new {
6 743     743 0 1249 my ($class, $stuff) = @_;
7              
8             # %ENV is global, so localize to %env
9 743 100       11999 my %env = ! defined $stuff ? %ENV : (HTTP_USER_AGENT => $stuff);
10 743         6085 return bless { env => \%env }, $class;
11             }
12              
13             sub get {
14 1516     1516 0 2540 my ($self, $header) = @_;
15 1516         2564 $header =~ tr/-/_/;
16 1516         9655 return $self->{env}->{"HTTP_" . uc($header)};
17             }
18              
19             1;