line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package ASP4::ConfigNode::Web; |
3
|
|
|
|
|
|
|
|
4
|
9
|
|
|
9
|
|
42
|
use strict; |
|
9
|
|
|
|
|
14
|
|
|
9
|
|
|
|
|
325
|
|
5
|
9
|
|
|
9
|
|
40
|
use warnings 'all'; |
|
9
|
|
|
|
|
15
|
|
|
9
|
|
|
|
|
438
|
|
6
|
9
|
|
|
9
|
|
42
|
use base 'ASP4::ConfigNode'; |
|
9
|
|
|
|
|
17
|
|
|
9
|
|
|
|
|
3164
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new |
10
|
|
|
|
|
|
|
{ |
11
|
9
|
|
|
9
|
0
|
22
|
my $class = shift; |
12
|
|
|
|
|
|
|
|
13
|
9
|
|
|
|
|
79
|
my $s = $class->SUPER::new( @_ ); |
14
|
9
|
|
50
|
|
|
36
|
$s->{handler_resolver} ||= 'ASP4::HTTPContext::HandlerResolver'; |
15
|
9
|
|
50
|
|
|
32
|
$s->{handler_runner} ||= 'ASP4::HTTPContext::HandlerRunner'; |
16
|
9
|
|
50
|
|
|
24
|
$s->{filter_resolver} ||= 'ASP4::HTTPContext::FilterResolver'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
map { |
19
|
9
|
50
|
|
|
|
23
|
$_->{uri_match} = undef unless defined($_->{uri_match}); |
|
9
|
|
|
|
|
29
|
|
20
|
9
|
50
|
|
|
|
32
|
$_->{uri_equals} = undef unless defined($_->{uri_equals}); |
21
|
9
|
|
|
|
|
68
|
$_ = $class->SUPER::new( $_ ); |
22
|
|
|
|
|
|
|
} $s->request_filters; |
23
|
|
|
|
|
|
|
map { |
24
|
9
|
50
|
|
|
|
39
|
$_->{uri_match} = undef unless defined($_->{uri_match}); |
|
36
|
|
|
|
|
77
|
|
25
|
36
|
50
|
|
|
|
76
|
$_->{uri_equals} = undef unless defined($_->{uri_equals}); |
26
|
36
|
|
50
|
|
|
431
|
$_->{disable_session} ||= 0; |
27
|
36
|
|
50
|
|
|
285
|
$_->{disable_application} ||= 0; |
28
|
36
|
|
|
|
|
90
|
$_ = $class->SUPER::new( $_ ); |
29
|
|
|
|
|
|
|
} $s->disable_persistence; |
30
|
9
|
|
|
|
|
28
|
return $s; |
31
|
|
|
|
|
|
|
}# end new() |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub request_filters |
35
|
|
|
|
|
|
|
{ |
36
|
29
|
|
|
29
|
1
|
60
|
my $s = shift; |
37
|
|
|
|
|
|
|
|
38
|
29
|
|
|
|
|
41
|
@{ $s->{request_filters} }; |
|
29
|
|
|
|
|
98
|
|
39
|
|
|
|
|
|
|
}# end request_filters() |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub disable_persistence |
43
|
|
|
|
|
|
|
{ |
44
|
5139
|
|
|
5139
|
0
|
4386
|
my $s = shift; |
45
|
|
|
|
|
|
|
|
46
|
5139
|
|
|
|
|
3412
|
@{ $s->{disable_persistence} }; |
|
5139
|
|
|
|
|
9633
|
|
47
|
|
|
|
|
|
|
}# end disable_persistence() |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1;# return true: |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=pod |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 NAME |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
ASP4::ConfigNode::Web - The $Config->web object. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 SYNOPSIS |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Given the following configuration... |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
{ |
62
|
|
|
|
|
|
|
... |
63
|
|
|
|
|
|
|
web: { |
64
|
|
|
|
|
|
|
application_name: "DefaultApp", |
65
|
|
|
|
|
|
|
application_root: "@ServerRoot@", |
66
|
|
|
|
|
|
|
www_root: "@ServerRoot@/htdocs", |
67
|
|
|
|
|
|
|
handler_root: "@ServerRoot@/handlers", |
68
|
|
|
|
|
|
|
page_cache_root: "/tmp/PAGE_CACHE", |
69
|
|
|
|
|
|
|
handler_resolver: "ASP4::HandlerResolver", |
70
|
|
|
|
|
|
|
handler_runner: "ASP4::HandlerRunner", |
71
|
|
|
|
|
|
|
filter_resolver: "ASP4::FilterResolver", |
72
|
|
|
|
|
|
|
request_filters: [ |
73
|
|
|
|
|
|
|
{ |
74
|
|
|
|
|
|
|
uri_match: "^/.*", |
75
|
|
|
|
|
|
|
filter_class: "My::Filter" |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
], |
78
|
|
|
|
|
|
|
disable_persistence: [ |
79
|
|
|
|
|
|
|
{ |
80
|
|
|
|
|
|
|
uri_match: "^/nostate/.*", |
81
|
|
|
|
|
|
|
disable_session: true, |
82
|
|
|
|
|
|
|
disable_application: false |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
] |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
... |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
You would access it like this: |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
$Config->web->application_name; # 'MyApp' |
92
|
|
|
|
|
|
|
$Config->web->application_root; # '/usr/local/projects/mysite.com' |
93
|
|
|
|
|
|
|
$Config->web->handler_root; # '/usr/local/projects/mysite.com/handlers' |
94
|
|
|
|
|
|
|
$Config->web->www_root; # '/usr/local/projects/mysite.com/htdocs' |
95
|
|
|
|
|
|
|
$Config->web->page_cache_root; # '/tmp/PAGE_CACHE' |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
You will never need to do this: |
98
|
|
|
|
|
|
|
foreach my $filter ( $Config->web->request_filters ) |
99
|
|
|
|
|
|
|
{ |
100
|
|
|
|
|
|
|
my $regexp = $filter->uri_match; |
101
|
|
|
|
|
|
|
my $class = $filter->class; |
102
|
|
|
|
|
|
|
}# end foreach() |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 DESCRIPTION |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
ASP4::ConfigNode::Web provides access to the C portion of the configuration. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 PUBLIC PROPERTIES |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head2 application_name |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Returns the name of the application. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head2 application_root |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Returns the absolute path to the root of the application, i.e. C |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head2 handler_root |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Returns the absolute path to where the 'handlers' are installed, i.e. C |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head2 www_root |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Returns the absolute path to where the normal website files (ASP, images, css, javascripts, etc) are located, |
125
|
|
|
|
|
|
|
i.e. C |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head2 page_cache_root |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Returns the absolute path to where 'compiled' ASP scripts are stored, i.e. C |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Since the 'compiled' ASP scripts are overwritten whenever the source ASP script has been changed on disk, |
132
|
|
|
|
|
|
|
the webserver process must have read/write access to this location. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
It is recommended that a temporary path is used - '/tmp' on most Linux distributions. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head2 request_filters |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Returns a list of ConfigNodes that represent individual C elements in the configuration. |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head1 SEE ALSO |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
L |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head1 BUGS
|
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
It's possible that some bugs have found their way into this release.
|
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Use RT L to submit bug reports.
|
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head1 HOMEPAGE
|
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
Please visit the ASP4 homepage at L to see examples
|
153
|
|
|
|
|
|
|
of ASP4 in action.
|
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head1 AUTHOR
|
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
John Drago
|
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE
|
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
Copyright 2007 John Drago, All rights reserved.
|
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
This software is free software. It may be used and distributed under the
|
164
|
|
|
|
|
|
|
same terms as Perl itself.
|
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=cut |
167
|
|
|
|
|
|
|
|