Mercurial > pub > Impl
comparison Lib/IMPL/Web/QueryHandler/PathInfoRewrite.pm @ 161:47c9877ccacc
Added a handler for rewriting a PATH_INFO value, useful with a json handlers
author | wizard |
---|---|
date | Tue, 28 Dec 2010 14:58:17 +0300 |
parents | |
children | 4267a2ac3d46 |
comparison
equal
deleted
inserted
replaced
160:3f09584bf189 | 161:47c9877ccacc |
---|---|
1 package IMPL::Web::QueryHandler::PathInfoRewrite; | |
2 use strict; | |
3 | |
4 use base qw(IMPL::Web::QueryHandler); | |
5 __PACKAGE__->PassThroughArgs; | |
6 | |
7 use IMPL::Class::Property; | |
8 | |
9 BEGIN { | |
10 public property pathinfoPrefix => prop_all; | |
11 } | |
12 | |
13 sub Process { | |
14 my ($this,$query,$nextHandler) = @_; | |
15 | |
16 my $pathInfo = $ENV{PATH_INFO}; | |
17 if (my $rx = $this->pathinfoPrefix) { | |
18 $pathInfo =~ s/^($rx)//; | |
19 } | |
20 | |
21 local $ENV{PATH_INFO} = $pathInfo; | |
22 | |
23 scalar $nextHandler->(); | |
24 } | |
25 | |
26 1; |