PassHtml.pm untested

filter: Statementstmt 0.0% 0 / 18 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 3 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 35 CC 3 SCAR 20.8
CC
3
Cov
0%
handler
12.0
BEGIN
2.0
BEGIN
2.0
CRAP 8.0
1  
2 =head1 NAME
3  
4 Apache::PassHtml - print out the html file
5  
6 =cut
7  
8 package Apache::PassHtml;
9 use strict;
10 use Apache::Constants ':common';
11 sub handler
12 {
13 my $r = shift;
14 my $filename = $r->filename();
15 return DECLINED unless $filename =~ /\.html$/;
16  
17 if (-f $filename and -r $filename and open FILE, $filename)
18 {
19 $r->status(200);
20 $r->send_http_header;
21 local ($_);
22 while (<FILE>)
23 { print $_; }
24 close FILE;
25 return OK;
26 }
27 return DECLINED;
28 }
29 1;
30  
31 =head1 SYNOPSIS
32  
33 In the conf/access.conf file of your Apache installation add lines
34  
35 <Files *.html>
36 SetHandler perl-script
37 PerlHandler Apache::OutputChain Apache::MakeCapital Apache::PassHtml
38 </Files>
39  
40 =head1 DESCRIPTION
41  
42 This is simple script to show the use of module B<Apache::OutputChain>.
43 It will pick up a html file and send it to the output, STDOUT. We
44 assume that the output is tied either to Apache (by default), or some
45 user-defined perl handler. We need to read and write to STDOUT in perl
46 since Apache will not pass its output into perl handlers.
47  
48 =head1 AUTHOR
49  
50 (c) 1997--1998 Jan Pazdziora
51  
52 =cut
53