[cgiapp] ::Server vs ::Dispatch::Server: Worth having both?

Bradley C Bailey cgiapp at brad.memoryleak.org
Wed Sep 17 12:35:47 EDT 2008


Mark,

> CGI::Application::Dispatch::Server was released in Summer of '07, in part
> because CGI::Application::Server didn't have dispatching support.
> 
> But soon after, in the fall, CGI::Application::Server was released, which
> supports both dispatched and "regular" CGI::App entry points.
> 
> In reviewing the projects today, it seems likes CGI::Application::Server seems
> to cover all the bases. Is there any reason not to combine efforts and focus on
> just CGI::Application::Server ? 
> 
> As far as I can tell ::Dispatch::Server doesn't seem to offer much additional
> functionality, or a significantly different API.
> 
> Having both will certainly be confusing some new users now due to the similarity. 
> At a minimum, at least of them should document its differences and benefits over the other.

I fully agree here.  The impression I got is that since there is a 
CGI::Application::Dispatch::Server, then I must use that if I use CAD.

It's been a while since I looked at either closely, so I just looked at 
the source and here are my first opinions of what would need to be done 
to CA::Server to handle the way that I was using CAD::Server.

- Need a way to specify parameters to dispatch()

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

- The order in which static files is served is different.

I set up my apps so that / is dispatched, but /static maps to static 
files.  Looking at CA::Server, it does not appear that this would be 
possible currently because it would always try and dispatch.  In 
CAD::Server it tries to serve files staticly first before sending to 
dispatch.  I think the best solution would be to specify a way to mark 
an entry point in the CA::Server config to specify static content.  Then 
I could do something like this:

   $server->entry_points({
       '/' => 'My::App::Dispatch',
       '/static' => undef,  # or maybe even pass a directory path to 
override document_root
   });

Other than these points the code looks to be basically the same.  I'd 
like to see them combined.

Regards,
Bradley C Bailey



More information about the cgiapp mailing list