view Lib/IMPL/Web/QueryHandler/PathInfoRewrite.pm @ 191:78a18a2b6266

IMPL::Web::View improvements (unstable)
author cin
date Thu, 05 Apr 2012 17:51:51 +0400
parents d1676be8afcc
children 4d0e1962161c
line wrap: on
line source

package IMPL::Web::QueryHandler::PathInfoRewrite;
use strict;

use parent qw(IMPL::Web::QueryHandler);
__PACKAGE__->PassThroughArgs;

use IMPL::Class::Property;

BEGIN {
	public property pathinfoPrefix => prop_all;
}

sub Process {
	my ($this,$query,$nextHandler) = @_;
	
	my $pathInfo = $ENV{PATH_INFO};
	if (my $rx = $this->pathinfoPrefix) {
		$pathInfo =~ s/^($rx)//;
	}
	
	local $ENV{PATH_INFO} = $pathInfo;
	
	scalar $nextHandler->();
}

1;