PassExec.pm untested

filter: Statementstmt 0.0% 0 / 35 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 11 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 63 CC 3 SCAR 13.9
CC
3
Cov
0%
BUFFERSIZE
6.0
handler
6.0
BEGIN
2.0
CRAP 4.0
1 package Apache::PassExec;
2 use Apache::Constants ':common';
3 use FileHandle;
4 use strict;
5 use vars qw($VERSION $BUFFERSIZE);
6 $BUFFERSIZE = 16384;
7  
8 $VERSION = "0.05";
9  
10 sub BUFFERSIZE {
11 my($self,$new) = @_;
12 $new += 0 if $new;
13 $BUFFERSIZE = $new || $BUFFERSIZE || 16384;
14 }
15  
16 sub handler {
17 my $r = shift;
18 my $filename = $r->filename();
19 my $fh;
20  
21 if (-f $filename and
22 -x _ and
23 $fh = FileHandle->new("$filename |")) {
24 print STDERR "$filename |\n";
25 my $headers;
26 { local $/ = "\n\n";
27 $headers = <$fh>; $r->send_cgi_header($headers); }
28  
29 my $buf;
30 local $\;
31  
32 while (defined($buf = <$fh>)){
33 print $buf;
34 }
35 $fh->close;
36 return OK;
37 } else {
38 return NOT_FOUND;
39 }
40 }
41  
42 1;
43  
44 __END__