annotate Lib/IMPL/Web/QueryHandler/PathInfoRewrite.pm @ 233:3cebcf6fdb9b

refactoring, cleaning code
author sergey
date Thu, 11 Oct 2012 04:53:08 +0400
parents 4d0e1962161c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
161
47c9877ccacc Added a handler for rewriting a PATH_INFO value, useful with a json handlers
wizard
parents:
diff changeset
1 package IMPL::Web::QueryHandler::PathInfoRewrite;
47c9877ccacc Added a handler for rewriting a PATH_INFO value, useful with a json handlers
wizard
parents:
diff changeset
2 use strict;
47c9877ccacc Added a handler for rewriting a PATH_INFO value, useful with a json handlers
wizard
parents:
diff changeset
3
166
4267a2ac3d46 Added Class::Template,
wizard
parents: 161
diff changeset
4 use parent qw(IMPL::Web::QueryHandler);
161
47c9877ccacc Added a handler for rewriting a PATH_INFO value, useful with a json handlers
wizard
parents:
diff changeset
5 __PACKAGE__->PassThroughArgs;
47c9877ccacc Added a handler for rewriting a PATH_INFO value, useful with a json handlers
wizard
parents:
diff changeset
6
47c9877ccacc Added a handler for rewriting a PATH_INFO value, useful with a json handlers
wizard
parents:
diff changeset
7 use IMPL::Class::Property;
47c9877ccacc Added a handler for rewriting a PATH_INFO value, useful with a json handlers
wizard
parents:
diff changeset
8
47c9877ccacc Added a handler for rewriting a PATH_INFO value, useful with a json handlers
wizard
parents:
diff changeset
9 BEGIN {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
10 public property pathinfoPrefix => prop_all;
161
47c9877ccacc Added a handler for rewriting a PATH_INFO value, useful with a json handlers
wizard
parents:
diff changeset
11 }
47c9877ccacc Added a handler for rewriting a PATH_INFO value, useful with a json handlers
wizard
parents:
diff changeset
12
47c9877ccacc Added a handler for rewriting a PATH_INFO value, useful with a json handlers
wizard
parents:
diff changeset
13 sub Process {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
14 my ($this,$query,$nextHandler) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
15
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
16 my $pathInfo = $ENV{PATH_INFO};
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
17 if (my $rx = $this->pathinfoPrefix) {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
18 $pathInfo =~ s/^($rx)//;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
19 }
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
20
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
21 local $ENV{PATH_INFO} = $pathInfo;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
22
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
23 scalar $nextHandler->();
161
47c9877ccacc Added a handler for rewriting a PATH_INFO value, useful with a json handlers
wizard
parents:
diff changeset
24 }
47c9877ccacc Added a handler for rewriting a PATH_INFO value, useful with a json handlers
wizard
parents:
diff changeset
25
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 166
diff changeset
26 1;