You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Stuart Moffatt <st...@bridgewatersystems.com> on 2003/12/04 18:11:25 UTC

Comments on Struts-like mod_perl module

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 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.

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. 

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.

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?

Thanks,
Stuart
 
Stuart Moffatt - smoffatt@bridgewatersystems.com
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


Re: Comments on Struts-like mod_perl module

Posted by Stas Bekman <st...@stason.org>.
Chris Winters wrote:
> Stas Bekman wrote:
> 
>> Apache::Straps sounds unique enough to me, though recently quite a few 
>> people have voiced their pain in having core API and applications all 
>> living in the Apache:: namespace. So you may want to consider putting 
>> it under Apache::App::Straps, or Apache::MVC::Straps, or something 
>> else...

BTW, Per Einar has created this module naming advisory some time ago:
http://perl.apache.org/products/apache-modules.html#Module_Naming_Conventions

> It's probably frowned upon by the namespace purists, but FWIW the next 
> version of OpenInteract (another webapp framework with some 
> Struts-inspired features) has just the Apache-related stuff in the 
> Apache:: namespace. Everything else is in OpenInteract2::.

Why? Sounds perfectly well to me.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


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


Re: Comments on Struts-like mod_perl module

Posted by Chris Winters <ch...@cwinters.com>.
Stas Bekman wrote:
> Apache::Straps sounds unique enough to me, though recently quite a few 
> people have voiced their pain in having core API and applications all 
> living in the Apache:: namespace. So you may want to consider putting it 
> under Apache::App::Straps, or Apache::MVC::Straps, or something else...

It's probably frowned upon by the namespace purists, but FWIW the 
next version of OpenInteract (another webapp framework with some 
Struts-inspired features) has just the Apache-related stuff in 
the Apache:: namespace. Everything else is in OpenInteract2::.

Chris

-- 
Chris Winters (chris@cwinters.com)
Building enterprise-capable snack solutions since 1988.


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


Re: Comments on Struts-like mod_perl module

Posted by Stas Bekman <st...@stason.org>.
Stuart Moffatt wrote:
[...]
> 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.
> 
> 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.

Apache::Straps sounds unique enough to me, though recently quite a few people 
have voiced their pain in having core API and applications all living in the 
Apache:: namespace. So you may want to consider putting it under 
Apache::App::Straps, or Apache::MVC::Straps, or something else...

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


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


Re: Comments on Struts-like mod_perl module

Posted by "Ken Y. Clark" <kc...@logsoft.com>.
On Thu, Dec 04, 2003 at 12:11:25PM -0500, Stuart Moffatt wrote:
[...]
> 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.

Stuart,

Sounds very interesting!  The best place to take up CPAN naming issues
is on "module-authors@perl.org."  More info:

    http://lists.perl.org/showlist.cgi?name=module-authors

Try posting your ideas there to clear the namespace.

ky

Re: Comments on Struts-like mod_perl module

Posted by Gunther Birznieks <gu...@selenasol.com>.

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