RWDE/Web/SCGIadapter.pm untested

filter: Statementstmt 0.0% 0 / 48 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 62 CC 2 SCAR 10.0
CC
2
Cov
0%
initialize
6.0
run_command
2.0
BEGIN
2.0
CRAP 2.7
1 package RWDE::Web::SCGIadapter;
2  
3 use strict;
4 use warnings;
5  
6 use CGI;
7 use SCGI::Request;
8  
9 use Error qw(:try);
10 use RWDE::Exceptions;
11  
12 use base qw(RWDE::Web::CGIadapter);
13  
14 use vars qw($VERSION);
15 $VERSION = sprintf "%d", q$Revision: 566 $ =~ /(\d+)/;
16  
17 # set up the SCGI interaction and return the new object. called from
18 # superclass new() method.
19 sub initialize {
20 my $self = shift;
21 my $params = shift;
22  
23 my $sock = $$params{sock};
24 my $req = SCGI::Request->_new($sock,1); # blocking socket mode
25  
26 $req->read_env;
27 %ENV = %{$req->env};
28  
29 my $cgi;
30  
31 if ($req->env->{REQUEST_METHOD} eq 'POST') {
32 # read $req->connection, my $body, $req->env->{CONTENT_LENGTH};
33 local *STDIN = $req->connection;
34 $cgi = CGI->new();
35 } else {
36 $cgi = CGI->new();
37 }
38  
39 CGI->_reset_globals;
40  
41 $self->{req} = $cgi;
42  
43 return;
44 }
45  
46 sub run_command {
47 my ($self, $params) = @_;
48  
49 try{
50 RWDE::Web::CommandProxy->execute({ req => $self });
51 }
52  
53 catch Error with{
54 my $ex = shift;
55  
56 $self->syslog_msg('info', "dispatch caught: $ex");
57 $self->syslog_msg('info', "This is beyond unusual, exceptions are caught here to avoid server going down");
58 };
59  
60 return();
61 }
62  
63  
64 1;