line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MasonX::Request::WithApacheSession; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
42476
|
use 5.005; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
100
|
|
4
|
2
|
|
|
2
|
|
13
|
use strict; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
85
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
14952
|
use vars qw($VERSION @ISA); |
|
2
|
|
|
|
|
14
|
|
|
2
|
|
|
|
|
262
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
$VERSION = '0.31'; |
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
5265
|
use Apache::Session::Wrapper 0.13; |
|
2
|
|
|
|
|
18903
|
|
|
2
|
|
|
|
|
107
|
|
11
|
|
|
|
|
|
|
|
12
|
2
|
|
|
2
|
|
21
|
use HTML::Mason 1.16; |
|
2
|
|
|
|
|
56
|
|
|
2
|
|
|
|
|
68
|
|
13
|
2
|
|
|
2
|
|
11
|
use HTML::Mason::Exceptions ( abbr => [ qw( param_error error ) ] ); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
42
|
|
14
|
2
|
|
|
2
|
|
193
|
use HTML::Mason::Request; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
68
|
|
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
2
|
|
11
|
use Params::Validate qw(:all); |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
2052
|
|
17
|
|
|
|
|
|
|
Params::Validate::validation_options( on_fail => sub { param_error( join '', @_ ) } ); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# This may change later |
20
|
|
|
|
|
|
|
@ISA = qw(HTML::Mason::Request); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# |
24
|
|
|
|
|
|
|
# This is a bit of a hack, ideally we could do this: |
25
|
|
|
|
|
|
|
# |
26
|
|
|
|
|
|
|
# __PACKAGE__->contained_objects( class => 'Apache::Session::Wrapper', |
27
|
|
|
|
|
|
|
# prefix => 'session_', |
28
|
|
|
|
|
|
|
# ); |
29
|
|
|
|
|
|
|
# |
30
|
|
|
|
|
|
|
# and let Class::Container sort it all out. We'd also need a way to |
31
|
|
|
|
|
|
|
# override some of the contained class's defaults. |
32
|
|
|
|
|
|
|
# |
33
|
|
|
|
|
|
|
my $wrapper_p = Apache::Session::Wrapper->valid_params; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
{ |
36
|
|
|
|
|
|
|
my %p = map { ( "session_$_" => $wrapper_p->{$_} ) } keys %$wrapper_p; |
37
|
|
|
|
|
|
|
foreach my $k ( grep { exists $p{$_}{depends} } keys %p ) |
38
|
|
|
|
|
|
|
{ |
39
|
|
|
|
|
|
|
my %new = %{ $p{$k} }; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
my @d = ref $new{depends} ? @{ $new{depends} } : $new{depends}; |
42
|
|
|
|
|
|
|
$new{depends} = [ map { ( "session_$_" ) } @d ]; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
$p{$k} = \%new; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
$p{session_cookie_name}{default} = 'MasonX-Request-WithApacheSession-cookie'; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# We'll always provide this, so the user doesn't need to. |
50
|
|
|
|
|
|
|
delete $p{session_param_name}{depends}; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
__PACKAGE__->valid_params |
53
|
|
|
|
|
|
|
( # This is for backwards compatibility, it's been renamed to |
54
|
|
|
|
|
|
|
# param_name |
55
|
|
|
|
|
|
|
session_args_param => |
56
|
|
|
|
|
|
|
{ type => SCALAR, |
57
|
|
|
|
|
|
|
optional => 1, |
58
|
|
|
|
|
|
|
descr => 'Name of the parameter to use for session tracking', |
59
|
|
|
|
|
|
|
}, |
60
|
|
|
|
|
|
|
%p, |
61
|
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub new |
65
|
|
|
|
|
|
|
{ |
66
|
|
|
|
|
|
|
|
67
|
21
|
|
|
21
|
1
|
92671
|
my $class = shift; |
68
|
|
|
|
|
|
|
|
69
|
21
|
50
|
|
|
|
284
|
$class->alter_superclass( $HTML::Mason::ApacheHandler::VERSION ? |
|
|
50
|
|
|
|
|
|
70
|
|
|
|
|
|
|
'HTML::Mason::Request::ApacheHandler' : |
71
|
|
|
|
|
|
|
$HTML::Mason::CGIHandler::VERSION ? |
72
|
|
|
|
|
|
|
'HTML::Mason::Request::CGI' : |
73
|
|
|
|
|
|
|
'HTML::Mason::Request' ); |
74
|
|
|
|
|
|
|
|
75
|
21
|
|
|
|
|
3464
|
my $self = $class->SUPER::new(@_); |
76
|
|
|
|
|
|
|
|
77
|
21
|
100
|
|
|
|
6909
|
return $self if $self->is_subrequest; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
# backwards compatibility |
80
|
19
|
50
|
|
|
|
344
|
$self->{session_param_name} = |
81
|
|
|
|
|
|
|
$self->{session_args_param} if exists $self->{session_args_param}; |
82
|
|
|
|
|
|
|
|
83
|
19
|
|
|
|
|
33
|
my %extra; |
84
|
19
|
50
|
|
|
|
425
|
if ( $self->can('apache_req') ) |
|
|
50
|
|
|
|
|
|
85
|
|
|
|
|
|
|
{ |
86
|
0
|
|
|
|
|
0
|
%extra = ( header_object => $self->apache_req, |
87
|
|
|
|
|
|
|
param_object => $self->apache_req, |
88
|
|
|
|
|
|
|
); |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
elsif ( $self->can('cgi_process') ) |
91
|
|
|
|
|
|
|
{ |
92
|
0
|
|
|
|
|
0
|
%extra = ( header_object => $self->cgi_request, |
93
|
|
|
|
|
|
|
param_object => $self->cgi_object, |
94
|
|
|
|
|
|
|
); |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
342
|
|
|
|
|
901
|
$self->{apache_session_wrapper} = |
98
|
|
|
|
|
|
|
Apache::Session::Wrapper->new |
99
|
|
|
|
|
|
|
( %extra, |
100
|
722
|
|
|
|
|
1719
|
map { $_ => $self->{"session_$_"} } |
101
|
19
|
|
|
|
|
281
|
grep { exists $self->{"session_$_"} } |
102
|
|
|
|
|
|
|
keys %$wrapper_p |
103
|
|
|
|
|
|
|
); |
104
|
|
|
|
|
|
|
|
105
|
19
|
|
|
|
|
23011
|
return $self; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub wrapper |
109
|
|
|
|
|
|
|
{ |
110
|
68
|
100
|
|
68
|
0
|
230
|
$_[0]->is_subrequest |
111
|
|
|
|
|
|
|
? $_[0]->parent_request->wrapper |
112
|
|
|
|
|
|
|
: $_[0]->{apache_session_wrapper} |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub exec |
116
|
|
|
|
|
|
|
{ |
117
|
21
|
|
|
21
|
1
|
331
|
my $self = shift; |
118
|
|
|
|
|
|
|
|
119
|
21
|
100
|
|
|
|
90
|
return $self->SUPER::exec(@_) |
120
|
|
|
|
|
|
|
if $self->is_subrequest; |
121
|
|
|
|
|
|
|
|
122
|
19
|
|
|
|
|
218
|
my @r; |
123
|
|
|
|
|
|
|
|
124
|
19
|
50
|
|
|
|
72
|
if (wantarray) |
125
|
|
|
|
|
|
|
{ |
126
|
0
|
|
|
|
|
0
|
@r = $self->SUPER::exec(@_); |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
else |
129
|
|
|
|
|
|
|
{ |
130
|
19
|
|
|
|
|
158
|
$r[0] = $self->SUPER::exec(@_); |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
18
|
|
|
|
|
2487
|
$self->wrapper->cleanup_session; |
134
|
|
|
|
|
|
|
|
135
|
18
|
50
|
|
|
|
727
|
return wantarray ? @r : $r[0]; |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
BEGIN |
139
|
|
|
|
|
|
|
{ |
140
|
2
|
|
|
2
|
|
8
|
foreach my $meth ( qw( session delete_session ) ) |
141
|
|
|
|
|
|
|
{ |
142
|
2
|
|
|
2
|
|
17
|
no strict 'refs'; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
164
|
|
143
|
4
|
|
|
49
|
|
17
|
*{$meth} = sub { shift->wrapper->$meth(@_) }; |
|
4
|
|
|
|
|
142
|
|
|
49
|
|
|
|
|
161
|
|
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
1; |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
__END__ |