2 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
######## Perl stuff
#
# perl.conf
#
# The following are mod_perl related things
#
#using Linux instead of win change .dll to .so
LoadFile /usr/local/perl/bin/perl58.dll
LoadModule perl_module modules/mod_perl.so
LoadFile bin/libapreq2.dll
LoadModule apreq_module modules/mod_apreq.so
SetEnv PERLLIB /usr/local/perl/lib;/usr/local/perl/site/lib
SetEnv PERL5LIB /usr/local/perl/lib;/usr/local/perl/site/lib
# If you want CGI outside ScriptAliased directories, uncomment the following lines.
#
#AddHandler cgi-script .cgi .pl
<Ifmodule mod_perl.c>
# The following is for mod_perl
include conf/mod_perl.conf
# The following is for HTML::Mason with mod_perl
include conf/mason-mod_perl.conf
</Ifmodule>
#
#
##### End of Perl stuff
----->snip<-----------
####
#
# mod_perl.conf for apache
PerlRequire conf/startup-mod_perl.pl
# Change path if not all right!
Alias /perl/ /usr/local/apache/perl/
#
<Location /perl>
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders
Options +execCGI
</Location>
---<snip>-----
#
# Config Mason with mod_perl
PerlRequire conf/mason-handler.pl
# Change path if not all right!
Alias /mason/ /usr/local/apache/mason/
<Location /mason>
SetHandler perl-script
PerlHandler HTML::Mason
</Location>
---<snip>-----
#### startup-mod_perl.pl
##
## StartUp file for mod_perl
##
use Apache2 ();
# change inc paths if
use lib qw (
/usr/local/apache/perl
/usr/local/perl/lib
/usr/local/perl/site/lib
);
#for mod_perl_1 compatibility
use Apache::compat ();
use ModPerl::Util (); #for CORE::GLOBAL::exit
use Apache::RequestRec ();
use Apache::RequestIO ();
use Apache::RequestUtil ();
use Apache::Session ();
use Apache::ServerRec ();
use Apache::ServerUtil ();
use Apache::Connection ();
use Apache::Log ();
use APR::Table ();
use ModPerl::Registry ();
use Apache::Const -compile => ':common';
use APR::Const -compile => ':common';
use CGI ();
1;
-------------<snip>---------------
#
# A basic, functional Mason handler.pl.
#
package HTML::Mason;
#
# Setup for mod_perl 2
use Apache2 ();
use lib qw(
/usr/local/apache/mason
/usr/local/perl/site/lib
/usr/local/perl/lib
);
use Apache::compat ();
# Preload CGI since we are using it for mod_perl 2
use CGI ();
# Bring in Mason with Apache support.
use HTML::Mason::ApacheHandler;
# List of modules that you want to use within components.
{
package HTML::Mason::Commands;
use Data::Dumper;
}
# Create Mason objects
my $ah = 0;
my $comproot = "/usr/local/apache/mason";
my $datadir = "/usr/local/apache/tmp/mason";
if ($HTML::Mason::VERSION < 1.18) { # Mason < 1.18
my $parser = new HTML::Mason::Parser;
my $interp = new HTML::Mason::Interp (
parser
=> $parser,
comp_root => $comproot,
data_dir => $datadir,
#error_mode => 'fatal', # Output to serverlog
error_mode => 'output',
#
#This may be brief , text , line , or html .
#These produce an error message with no trace,
#a multiline error with trace information,
#a single-line error with tab-separated fields (suitable for writing to a log),
#and a fancy HTML format.
error_format => 'html',
);
$ah = new HTML::Mason::ApacheHandler ( interp=>$interp );
}
else { # ab Mason >= 1.18!
$ah = new HTML::Mason::ApacheHandler (
comp_root=>$comproot,
data_dir=>$datadir,
#error_mode => 'fatal', # Output to serverlog
error_mode => 'output',
#
#This may be brief , text , line , or html .
#These produce an error message with no trace,
#a multiline error with trace information,
#a single-line error with tab-separated fields (suitable for writing to a log),
#and a fancy HTML format.
error_format => 'html',
);
}
}
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Activate the following if running httpd as root (the normal case).
# Resets ownership of all files created by Mason at startup.
#
#chown (Apache->server->uid, Apache->server->gid, $interp->files_written);
sub handler {
my ($r) = @_;
# If you plan to intermix images in the same directory as
# components, activate the following to prevent Mason from
# evaluating image files as components.
#
return -1 if $r->content_type && $r->content_type !~ m|^text/|i;
my $status = $ah->handle_request($r);
return $status;
}
1;
2 Einträge, 1 Seite |