Pat Gunn (dachte) wrote,
Pat Gunn
dachte

Cherniye Noble

I'm finally writing code for POUND 4.0, having just finished completed aworking stub. The multiple-file solution, which will be at least partly OO,is already creating nice benefits when it comes to code clarity. One littlegotcha -- because I like developing in my home directory, I ran into ahard to find gotcha -- if you expect Apache to use a module from your homedirectory, 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 thanI expected, and the software on the machines hooked up to it was incrediblycool, easily allowing very fluid changes in perspective while navigating thebrain. I was quite impressed. It was kind of strange that we had a view ofthe subject's eyes for the entire 2 hours on one of the monitors, and thesafety regulations were pretty neat. I feel kind of intimidated by the numberof 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 mypredecessor 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 jobwhere I'll need to do a lot of learning to be effective. That's a good thingtoo, of course, but I think some nervousness is to be expected. It turns outthat Dr Behrmann isn't just someone I respect -- she's well known and respectedthroughout the local community. That's pretty cool. I'm glad I had theopportunity to take a class from her, and wish I hadn't had crap going on inmy life to distract me from my studies. It's strange now that it looks likeI might be rubbing shoulders, to an extent, with professors/researchers thatI 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'mhandling 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 savedme 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.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><body><!-- Served by POUND $revision -->EOHSprint "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 hardprint <<EOFS;</body></html>EOFSreturn 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);}

Tags: blog, work
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments