Gunther said: >I like this as well. How is the performance under CGI though? Do you >support an identical config to struts? Which version of struts do you >support?
The performance under CGI is not too fast as the servlet.cgi is using Location headers to redirect to that action's view script. Plus, because there are no hooks into manipulating the URI, there are state reload issues. >Do you sit on top of wombat? The Perl Servlet API? Neither. Like I said, this is a simple replacement. The main handler is Servlet.pm which reads the servlet context and action path from the request. The servlet context is already config'd in httpd.conf like this: PerlModule Apache::Straps::Servlet <Location /myapp/ SetHandler perl-script PerlHandler Apache::Straps::Servlet PerlSendHeader On </Location> Then when the client hits http://<host>/myapp/get/account.do the Servlet.pm loads a Apache::Straps::Config object (kept as a Storable::File and parsed from corresponding XML at startup) from disk, looks for the action path, loads the action (and action form if necessary), the executes performAction in the action. This returns a success or error, which the servlet then uses to do an internal lookup. Here is what the XML looks like: <action path="/get/account.do"> <class>MyOrg::MyApp::client::actions::GetAccountAction</class> <forward name="success" path="/myapp/billing/account.pl" /> <forward name="error" path="/myapp/billing/index.pl" /> </action> The forward path (ie /myapp/billing/account.pl) does a bit of work setting up a template from Template Toolkit, which is processed and pushed to the client. That's the long way of saying: no wombat, no Perl Servlet API. At least not for this cut ;) >Interesting! Do you emulate the Struts widgets in HTML::Template? My original cgi used HTML::Template, but without Struts-like tiles or taglibs. The mod_perl uses Template Toolkit because it is the best template system around. As far as I know, it is like Struts 1.0, except that I can support multiple servlets just by adding a similar block in httpd.conf with a new location, and mapping the location directive to the same-name config file on disk. >I think the Apache-specific one should be Apache::App::Straps (similar >to Chris' thing) but that you should make this module as >Apache-specific >as possible but require CGI::Straps or Straps or >CGI::App::Straps as the >core set of modules that defines straps. Yeah, that would be nice. If I get the time... >If you put this project primarily under the Apache::* >namespace, it will >be mistakenly branded as being Apache-specific which it >shouldn't be IMHO. > >The best two examples of modules that were created under Apache::* >namespace and still (I believe) confuse people into thinking they are >only for mod_perl is Apache::Session (which can be used for CGIs) and >Apache::DBI (which can be used for other persistent Perl >environments). >I personally believe you should avoid this problem. You're right. I may go with just Straps or if I only release the mod_perl version, then something like Apache::App::Straps. >In addition, there are many other mechanisms for improving performance >of CGI from SpeedyCGI and I think Matt Sergeant has a PersistentPerl >interface, and then there is ActiveState's PerlEx (Not greatly >supported >these days but it does exist )for IIS and Velocigen as a commercial >product to embed Perl in Netscape And ISAPI Servers like IIS... etc.. > >So I think if a group of people used SpeedyCGI, you might find >your CGI >version of Straps having reasonable performance. Are you volunteering to make the CGI version work under those kits? >Where is the website? straps.sourceforge.com? :) Not yet. Like all of us, I am swamped at work with other code. Perhaps in January. And thanks for the tip on p5ee. A little overkill for what I need right now, but its good to know about. I'll let the list know when I release Straps. Thanks for all of your comments. [Back into lurk mode to finish some code...] Thanks, Stuart Stuart Moffatt - [EMAIL PROTECTED] Software Developer, User Interface - (613)591-6655 x2009 http://www.bridgewatersystems.com -- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html