The "Trick" in apache is this:
Put a perl script in the main directory with a name like "graph"
Then in the apache conf do:
<Location /graph>
SetHandler cgi-script
</Location>
(You may also have to set "Options ExecCGI" on either the
location or the directory it is in)
In your perl script, using "use CGI;" of course you can get the
path from your $cgi variable like this:
use CGI qw(:standard);
my $cgi = new CGI;
my $path = $cgi->path_info();
If you went to the site "http://x.org/graph/blue/green/fun.gif"
then $path would be set to "/blue/green/fun.gif"
Now you can split on / and get your args. If you are
getting you data from a DB and want cache's out in the world
to cache data that rarely changes, send the proper
"Expires: ..." header or the
"Last-Modified: ..." header.
Building your code inline like this and adding the extra headers
all you need to do for the caches. I built a cache in front of
a site like this and it saved me about 60% of the load on
my processor.