Time Heals All Wounds.. And Then Kills the Patient
<Previous Next>
Thu Jul 8 21:50:57 2004
Cherniye Noble

I'm finally writing code for POUND 4.0, having just finished completed a working stub. The multiple-file solution, which will be at least partly OO, is already creating nice benefits when it comes to code clarity. One little gotcha -- because I like developing in my home directory, I ran into a hard to find gotcha -- if you expect Apache to use a module from your home directory, you need to make sure Apache has permissions to read from there. Mode 700 is not productive in this case. I may eventually do it with ACLs, but for now, mode 755 is the name of the game. This is going to be so fun.

The fMRI went very well -- the machine was much louder and smaller than I expected, and the software on the machines hooked up to it was incredibly cool, easily allowing very fluid changes in perspective while navigating the brain. I was quite impressed. It was kind of strange that we had a view of the subject's eyes for the entire 2 hours on one of the monitors, and the safety regulations were pretty neat. I feel kind of intimidated by the number of parameters I'll need to know to be able to run experiments on the thing, and hope that I'll be able to learn everything I need to know before my predecessor leaves the lab and leaves town. It's really clear that this job, while certainly part sysadmin, is also partly a very different kind of job where I'll need to do a lot of learning to be effective. That's a good thing too, of course, but I think some nervousness is to be expected. It turns out that Dr Behrmann isn't just someone I respect -- she's well known and respected throughout the local community. That's pretty cool. I'm glad I had the opportunity to take a class from her, and wish I hadn't had crap going on in my life to distract me from my studies. It's strange now that it looks like I might be rubbing shoulders, to an extent, with professors/researchers that I so recently took classes from, and with people I respect so much.

For the interested, here's an interesting code snippet -- the core of how I'm handling requests through my mod_perl code. I've done the same thing in Java (albeit with very different code). If I had had this ages ago, it would've saved me a lot of poking around :)

sub handler { my ($apache_r) = @_; $apache_r->content_type('text/html'); my($request, @args) = get_request_from_uri($apache_r->uri());

print <<EOHS; <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.or g/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <body> <!-- Served by POUND $revision --> EOHS print "You asked for " . $apache_r->uri() . " in apache dir " . $apache_r->location() . "\n"; my ($request, @args) = get_request_from_uri($apache_r->uri() ); print "Command: $request\n"; print "Args: " . join("\n", @args); dispatch($request, $apache_r, @args) # Write your own -- it's not hard print <<EOFS; </body></html> EOFS return Apache::OK; }

sub get_request_from_uri($;) { my($uri) = @_; my ($cmd, @args); $uri =~ s/\/$//g; $uri =~ s/^\/$basepath\/?//; @args = split /\//, $uri; $cmd = shift(@args); return ($cmd, @args); }