annotate Lib/IMPL/Web/QueryHandler/PathInfoRewrite.pm @ 166:4267a2ac3d46

Added Class::Template, Rewritten SQL::Schema 'use parent' directive instead of 'use base'
author wizard
date Sat, 23 Apr 2011 23:12:06 +0400
parents 47c9877ccacc
children d1676be8afcc
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 {
47c9877ccacc Added a handler for rewriting a PATH_INFO value, useful with a json handlers
wizard
parents:
diff changeset
10 public property pathinfoPrefix => prop_all;
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 {
47c9877ccacc Added a handler for rewriting a PATH_INFO value, useful with a json handlers
wizard
parents:
diff changeset
14 my ($this,$query,$nextHandler) = @_;
47c9877ccacc Added a handler for rewriting a PATH_INFO value, useful with a json handlers
wizard
parents:
diff changeset
15
47c9877ccacc Added a handler for rewriting a PATH_INFO value, useful with a json handlers
wizard
parents:
diff changeset
16 my $pathInfo = $ENV{PATH_INFO};
47c9877ccacc Added a handler for rewriting a PATH_INFO value, useful with a json handlers
wizard
parents:
diff changeset
17 if (my $rx = $this->pathinfoPrefix) {
47c9877ccacc Added a handler for rewriting a PATH_INFO value, useful with a json handlers
wizard
parents:
diff changeset
18 $pathInfo =~ s/^($rx)//;
47c9877ccacc Added a handler for rewriting a PATH_INFO value, useful with a json handlers
wizard
parents:
diff changeset
19 }
47c9877ccacc Added a handler for rewriting a PATH_INFO value, useful with a json handlers
wizard
parents:
diff changeset
20
47c9877ccacc Added a handler for rewriting a PATH_INFO value, useful with a json handlers
wizard
parents:
diff changeset
21 local $ENV{PATH_INFO} = $pathInfo;
47c9877ccacc Added a handler for rewriting a PATH_INFO value, useful with a json handlers
wizard
parents:
diff changeset
22
47c9877ccacc Added a handler for rewriting a PATH_INFO value, useful with a json handlers
wizard
parents:
diff changeset
23 scalar $nextHandler->();
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
47c9877ccacc Added a handler for rewriting a PATH_INFO value, useful with a json handlers
wizard
parents:
diff changeset
26 1;