[cgiapp] Re: Titanium first impressions

Mark Stosberg mark at summersault.com
Fri Sep 12 22:01:37 EDT 2008


On Thu, 11 Sep 2008 09:55:03 +0100
Richard Jones <ra.jones at dpw.clara.co.uk> wrote:

> Mark Stosberg wrote:
> 
> > What more integration do you want? CGI::Application::Dispatch is included as a
> > dependency, and how to use them together is documented is recommended. I think
> > the current integration works cleanly and nicely. 
> 
> Yes, I noticed it's in the dependencies list after I posted, and had 
> only looked at the Titanium package itself. Oops. But we still have to 
> generate our own dispatcher, and I was being lazy and suggested there 
> might be one 'integrated' by default.

CGI::Application::Dispatch does provide default dispatching, you can
just call this:

CGI::Application::Dispatch->dispatch();

And quoted from the ::Dispatch documentation:

> It will translate a URI like this (under mod_perl):
> 
>     /app/module_name/run_mode
> 
> or this (vanilla cgi)
> 
>     /app/index.cgi/module_name/run_mode
> 
> into something that will be functionally similar to this
> 
>     my $app = Module::Name->new(..);
>     $app->mode_param(sub {'run_mode'}); #this will set the run mode

...

> I was thinking along the lines of Catalyst which has its own dispatcher 
> built it. So building an app with Catalyst, it 'just works' out of the 
> box (providing you're happy with the *way* it works), whereas with 
> C::A/Titanium I have to create my own dispatcher, as documented. Of 
> course the latter approach is the more flexible, but I think the optimum 
> would be an integrated default dispatcher that you could chose to 
> over-ride in preference to your own if you want (if that's possible). 
> I'm still struggling a bit with the dispatcher, and thought how nice it 
> would be if a dispatcher function was available out of the box.

I think either you've missed the default dispatcher described above, or
you are referring to the HTTP server that ships with Catalyst, that
allows you to immediately began testing your application with "Clean
URIs" without setting up mod_rewrite rules.  

Titanium 'depends' on the equivalent, CGI::Application::Server, which in
turn works with dispatching.  This is mentioned in passing in the
Titanium docs, but perhaps could be highlighted and detailed more. 

  use CGI::Application::Server;
  my $server = CGI::Application::Server->new();
     $server->document_root('./htdocs');
     $server->entry_points({
         '/app'   => 'MyCGIApp::Account::Dispatch',
     });
     $server->run();

Also, it would be nice to have a 'titanium-starter' script that created
a shell of an application for users that provided a more complete,
working example as well as jump-start on coding. 

> BTW, I think the Titanium concept is really good, and wish the project 
> well, just airing a few initial thoughts as I put a test app together.

Great! I really appreciate the feedback. 

    Mark

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





More information about the cgiapp mailing list