Stuart Moffatt wrote:

All,

About a month ago, I was put on a project that was perl-based, but with no
framework. As our GUI team develops mostly in java, and now mostly with
struts, I came to love the MVC architecture. Simple to estimate, design, and
maintain. I loved struts mvc so much that I implemented a struts-like
framework in plain old CGI. I used it for the perl project with great
success: quick, modular development from the client to the API.



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?

Do you sit on top of wombat? The Perl Servlet API?

I called it Straps (STRuts - A Perl Substitute). [Struts-developers: Let me
know if I've broken the rules for embedding Struts in the nickname]. It is a
bit of a cutesy name, but I didn't want to assume I could use Struts.pm --
and it really isn't just an interface to a struts-ish servlet, it actually
replaces one.



Sounds good to me.

The main controller, rather than a java servlet, is a cgi installed in the
docroot at /straps/servlet.cgi
All requests go through this cgi, fire off Actions and ActionForms (just
like struts), store data in the session. and then land on a resulting cgi
page that would get the data out of the session and load up an
HTML::Template for the view. The ActionForms contain our application data
models.




Interesting! Do you emulate the Struts widgets in HTML::Template?

All in all, a rudimentary, but working version of a perl implementation of
struts.

But like most CGI apps, there were failings (performance, URI control, etc)

In the last two weeks, I've converted the "servlet" cgi to mod_perl, and
made it look like a real struts servlet. I have not ported the application
yet, but I have a new project that is also perl so I will build this app on
top of the mod_perl version of Straps, which I am tentatively calling
Apache::Straps. You all know the kinds of speed improvements I've seen
(100-150x on the loading of the framework alone with a small test
application), not to mention the hooks into the URI-mapping and request
cycle that I am ecstatic about.



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.

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.

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.

Anyway, I thought the Right Thing To Do was get the idea out on this list
before any upload to CPAN, etc. I suppose at some point I'd have to talk to
the Struts people to find out if they mind as the framework and config file
uses the same naming conventions as struts.

Comments?



Where is the website? straps.sourceforge.com? :)

Is there a mailing list I can subscribe to? You might want to also cross post to the p5ee mailing list ... as servlet API to some degree falls a little bit under p5ee (servlets being a part of j2ee).

Good Luck!
Gunther





--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html



Reply via email to