view Lib/IMPL/Web/QueryHandler/PathInfoRewrite.pm @ 162:39c8788eded5

corrected PATH_INFO handling
author wizard
date Wed, 29 Dec 2010 16:55:24 +0300
parents 47c9877ccacc
children 4267a2ac3d46
line wrap: on
line source

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

use base 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;