[cgiapp] Possible patches for ::Server (was: Re: ::Server vs ::Dispatch::Server: Worth having both?)

Mark Stosberg mark at summersault.com
Wed Sep 17 20:57:37 EDT 2008


> Patches welcome.

I'd like to provide feedback on various proposed changes to CGI::Application::Server

> Need a way to specify parameters to dispatch()

I disagree. The recommended way to do this to define a 'dispatch_args'
routine in your CGI::Application::Dispatch subclass. I think George
discovered seperately that the "dispatch_args()" method in
::Dispatch::Server was too magical for it's own good. 

> ::Dispatch::Server prefers static files first, ::Server prefers dispatching first

I think it is a bug in ::Server that it prefers dispatching server. The
recommended use of ::Dispatch, and also for Drupal, is to use a rewrite
rule that will serve static files directly if they match, otherwise the
request is passed on for possible dispatching. As Michael Peters pointed
out, this design should have better performance as well. 

So Ricardo, would you accept a patch to change this ordering?

> ::Server doesn't dispatch "/" ?

I confirmed this. Looking at the code, it can be boiled down to this:

  my $uri = "/first/second";
  while ( $uri ) {
          print "$uri\n";
          # Remove the rightmost path element
          $uri =~ s/\/[^\/]*$//;
  }

That will print out "/first/second" and then "/first", but never "/".  I
think this is a bug in ::Server. Richardo, would you accept a patch to
make "/" dispatchable? ( "" Would be treated the same ). 

> Both handle output capturing different.  Is one better than the other?

I couldn't find anything that seemed worth changing in this regard, so
my take now is that ::Server is OK here.

    Mark

-- 
http://mark.stosberg.com/





More information about the cgiapp mailing list