blib/lib/Apache/EP.pm untested

filter: Statementstmt 0.0% 0 / 53 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 77 CC 5 SCAR 24.8
CC
5
Cov
0%
handler
30.0
BEGIN
2.0
BEGIN
2.0
CRAP 12.0
1 # -*- perl -*-
2 #
3 # HTML::EP - A Perl based HTML extension.
4 #
5 #
6 # Copyright (C) 1998 Jochen Wiedmann
7 # Am Eisteich 9
8 # 72555 Metzingen
9 # Germany
10 #
11 # Phone: +49 7123 14887
12 # Email: joe@ispsoft.de
13 #
14 # All rights reserved.
15 #
16 # You may distribute this module under the terms of either
17 # the GNU General Public License or the Artistic License, as
18 # specified in the Perl README file.
19 #
20 ############################################################################
21  
22 require 5.004;
23 use strict;
24  
25  
26 use Apache ();
27 use DBI ();
28 use HTML::EP ();
29 use Symbol ();
30  
31 # Pull in HTML::EP and the helper packages
32 use HTML::EP ();
33 use HTML::EP::Locale ();
34 use HTML::EP::Session ();
35  
36  
37 package Apache::EP;
38  
39 $Apache::EP::VERSION = '0.1003';
40  
41 my $Is_Win32 = $^O eq "MSWin32";
42  
43  
44 sub handler ($$) {
45 my($class, $r) = @_;
46 if(ref $r) {
47 $r->request($r);
48 } else {
49 $r = Apache->request;
50 }
51 my $filename = $r->filename;
52 local $^W;
53  
54 if (($r->allow_options() & Apache::Constants::OPT_EXECCGI()) == 0) {
55 $r->log_reason("Options ExecCGI is off in this directory",
56 $filename);
57 return Apache::Constants::FORBIDDEN();
58 }
59 if (!-r $filename || !-s _) {
60 $r->log_reason("File not found", $filename);
61 return Apache::Constants::NOT_FOUND();
62 }
63 if (-d _) {
64 $r->log_reason("attempt to invoke directory as script", $filename);
65 return Apache::Constants::FORBIDDEN();
66 }
67  
68 $r->chdir_file($filename);
69 $r->cgi_env('PATH_TRANSLATED' => $filename);
70 local $SIG{'__WARN__'} = \&HTML::EP::WarnHandler;
71 my $self = HTML::EP->new();
72 $self->{'_ep_r'} = $r;
73 $r->no_cache(1);
74 $self->CgiRun($filename, $r);
75 return Apache::Constants::OK();
76 }
77  
78  
79 1;