File Coverage

blib/lib/FCGI/Client/Constant.pm
Criterion Covered Total %
statement 14 15 93.3
branch n/a
condition n/a
subroutine 4 5 80.0
pod n/a
total 18 20 90.0


line stmt bran cond sub pod time code
1 1     1   5 use strict;
  1         2  
  1         22  
2 1     1   3 use warnings;
  1         1  
  1         73  
3              
4             package FCGI::Client::Constant;
5              
6             sub import {
7 4     4   47 my $const = {
8             # Number of bytes in a FCGI_Header. Future versions of the protocol
9             # will not reduce this number.
10             FCGI_HEADER_LEN => 8,
11              
12             # protocol version
13             FCGI_VERSION_1 => 1,
14              
15             # Mask for flags component of FCGI_BeginRequestBody
16             FCGI_KEEP_CONN => 1,
17              
18             # request role
19             FCGI_RESPONDER => 1,
20             FCGI_AUTHORIZER => 2,
21             FCGI_FILTER => 3,
22              
23             # Values for protocolStatus component of FCGI_EndRequestBody
24             FCGI_REQUEST_COMPLETE => 0,
25             FCGI_CANT_MPX_CONN => 1,
26             FCGI_OVERLOADED => 2,
27             FCGI_UNKNOWN_ROLE => 3,
28              
29             # packet type
30             FCGI_BEGIN_REQUEST => 1,
31             FCGI_ABORT_REQUEST => 2,
32             FCGI_END_REQUEST => 3,
33             FCGI_PARAMS => 4,
34             FCGI_STDIN => 5,
35             FCGI_STDOUT => 6,
36             FCGI_STDERR => 7,
37             FCGI_DATA => 8,
38             FCGI_GET_VALUES => 9,
39             FCGI_GET_VALUES_RESULT => 10,
40             FCGI_UNKNOWN_TYPE => 11,
41             };
42 4         9 my $pkg = caller(0);
43 1     1   5 no strict 'refs';
  1         11  
  1         83  
44 4         22 while (my ($k, $v) = each %$const) {
45 84     0   318 *{"$pkg\::$k"} = sub () { $v };
  84         1065  
  0            
46             }
47             }
48              
49             1;
50             __END__