line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTTP::Session::State::URI; |
2
|
3
|
|
|
3
|
|
17141
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
74
|
|
3
|
3
|
|
|
3
|
|
673
|
use HTTP::Session::State::Base; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
18
|
|
4
|
3
|
|
|
3
|
|
624
|
use HTML::StickyQuery; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
59
|
|
5
|
3
|
|
|
3
|
|
1057
|
use HTTP::Session::State::Mixin::ResponseFilter qw/response_filter/; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
906
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
__PACKAGE__->mk_ro_accessors(qw/session_id_name/); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
6
|
|
|
6
|
1
|
44
|
my $class = shift; |
11
|
6
|
50
|
|
|
|
54
|
my %args = ref($_[0]) ? %{$_[0]} : @_; |
|
0
|
|
|
|
|
0
|
|
12
|
|
|
|
|
|
|
# set default values |
13
|
6
|
|
50
|
|
|
32
|
$args{session_id_name} ||= 'sid'; |
14
|
6
|
|
|
|
|
49
|
bless {%args}, $class; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub get_session_id { |
18
|
6
|
|
|
6
|
1
|
585
|
my ($self, $req) = @_; |
19
|
6
|
100
|
|
|
|
190
|
Carp::croak "missing req" unless $req; |
20
|
5
|
|
|
|
|
71
|
$req->param($self->session_id_name); # hmm... this is not support psgi. |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub html_filter { |
24
|
4
|
|
|
4
|
1
|
43
|
my ($self, $session_id, $html) = @_; |
25
|
4
|
50
|
|
|
|
9
|
Carp::croak "missing session_id" unless $session_id; |
26
|
|
|
|
|
|
|
|
27
|
4
|
|
|
|
|
72
|
my $session_id_name = $self->session_id_name; |
28
|
|
|
|
|
|
|
|
29
|
4
|
|
|
|
|
35
|
$html =~ s{( |
30
|
|
|
|
|
|
|
|
31
|
4
|
|
|
|
|
20
|
my $sticky = HTML::StickyQuery->new; |
32
|
4
|
|
|
|
|
262
|
return $sticky->sticky( |
33
|
|
|
|
|
|
|
scalarref => \$html, |
34
|
|
|
|
|
|
|
param => { $session_id_name => $session_id }, |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub redirect_filter { |
39
|
3
|
|
|
3
|
1
|
25
|
my ( $self, $session_id, $path ) = @_; |
40
|
3
|
50
|
|
|
|
8
|
Carp::croak "missing session_id" unless $session_id; |
41
|
|
|
|
|
|
|
|
42
|
3
|
|
|
|
|
11
|
my $uri = URI->new($path); |
43
|
3
|
|
|
|
|
8410
|
$uri->query_form( $uri->query_form, $self->session_id_name => $session_id ); |
44
|
3
|
|
|
|
|
375
|
return $uri->as_string; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
__END__ |