package HTTP::Session::State::URI; use HTTP::Session::State::Base; use HTML::StickyQuery; __PACKAGE__->mk_ro_accessors(qw/session_id_name/); sub new { my $class = shift; my %args = ref($_[0]) ? %{$_[0]} : @_; # set default values $args{session_id_name} ||= 'sid'; bless {%args}, $class; } sub get_session_id { my ($self, $req) = @_; Carp::croak "missing req" unless $req; $req->param($self->session_id_name); } sub response_filter { my ($self, $session_id, $res) = @_; Carp::croak "missing session_id" unless $session_id; if ($res->code == 302) { if (my $uri = $res->header('Location')) { $res->header('Location' => $self->redirect_filter($session_id, $uri)); } return $res; } elsif ($res->content) { $res->content( $self->html_filter($session_id, $res->content) ); return $res; } else { return $res; # nop } } sub html_filter { my ($self, $session_id, $html) = @_; Carp::croak "missing session_id" unless $session_id; my $session_id_name = $self->session_id_name; $html =~ s/(