[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-modperl
Subject:    Generating  Apache::Registry package names
From:       Simon Rosenthal <srosenthal () northernlight ! com>
Date:       1999-04-30 18:14:45
[Download RAW message or body]


We've just run into a problem due to an interaction between a mod_rewrite
rule and Apache::Registry, whereby Apache::Registry is recompiling one
particular script many times because of many unique URIs which mod_rewrite
maps to the same script, but with different arguments.

i.e. we have a rewrite rule which converts URL [A-Z][A-Z]something.html ==>
/foo/bar/script.pl?arg=<something depending on the original URI>. And no,
we can't change the rewrite rule.

The code fragment in Apache::Registry which does this is pretty clear..

	my $uri = $r->uri;
                ********************
	$uri = "/__INDEX__" if $uri eq "/";
	# turn into a package name
	$r->log_error(sprintf "Apache::Registry::handler examining %s",
		      $uri) if $Debug && $Debug & 4;
	my $script_name = $r->path_info ?
	    substr($uri, 0, length($uri)-length($r->path_info)) :
		$uri;

which of course generates different package names depending on the original
URI, before translation. This in effect means we're recompiling each time,
which sort of defeats the purpose ;=)

Question. If we change the line  
   my $uri = $r->uri;

to 
   $uri = $r->filename (of course it isn't a URI any more; $uri is a
synonym for $package_identifier_root, I guess)

and remove the references to $path_info a few lines later, are we  opening
ourselves to any trouble ? I couldn't see any, but I thought I'd ask the
list gurus before I bring down  the whole server ....

-thankx

- Simon
-----------------------------------------------------
Simon Rosenthal	(srosenthal@northernlight.com)    	
Web Systems Architect
Northern Light Technology LLC				
222 Third Street,	Cambridge MA 02142
Phone:  (617)577-2796         Fax:      (617)577-7446     URL:
http://www.northernlight.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic