Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Web Application design patterns with Mod_perl

by avrono (Novice)
on Jul 25, 2010 at 17:59 UTC ( [id://851264]=perlquestion: print w/replies, xml ) Need Help??

avrono has asked for the wisdom of the Perl Monks concerning the following question:

Hi Wise Monks, I have been searching for some funky web application design patterns using mod_perl. I don't like MVC as it becomes very hard to manage for complex projects and is difficult to implement in a neat OO way. Any suggestions ?
  • Comment on Web Application design patterns with Mod_perl

Replies are listed 'Best First'.
Re: Web Application design patterns with Mod_perl
by intel (Beadle) on Jul 25, 2010 at 18:43 UTC
    Your question format is a little confusing for me because you are very specific about "web application design patterns using mod_perl"
    As I understand design patterns, they are not specific to a programming language, web programming or mod_perl, but higher-level computer science concepts.

    With that said, there is a great wiki with Perl implementations of design patterns, although I'm not sure which will apply to your specific webapp or mod_perl.
    http://perldesignpatterns.com/perldesignpatterns.html That page has pretty much every design pattern that I've ever heard of, and then some. Hope that helps.

      Many thanks, the link you sent goes some way to address my question, despite your confusion... Thanks for the post !
Re: Web Application design patterns with Mod_perl
by morgon (Priest) on Jul 25, 2010 at 18:54 UTC
    some funky web application design patterns using mod_perl

    Yeah, no information about what exactly your requirements are, but definitely got to be funky.

    I don't like MVC ...

    Oh yeah, so hard to manage and even though you could do it in a OO-way, it's never going to be "neat".

    Sorry, this posting is probably not very helpful to you (feel free to vote it down), but I can't make any sense out of this (are you looking for design patterns or a framework, what exactly are your objections to MVC, what exactly is needed for something to be "funky" or "neat"?).

    Should you be looking for a framework I recommend you overcome your MVC-aversion and have a look at Catalyst.

      Hi, I am not being specific -- because I am looking for common patterns, by definition these are things that occur frequently when creating any web application. Whilst I realize that being specific in terms of technology is not in keeping with the concept of a pattern, mod_perl or any other technology will have an impact on the application of any pattern. I don't want to go into my dislike of MVC, I was trying to avoid people suggesting Catalyst ... Thanks for you post, all responses are welcome !
Re: Web Application design patterns with Mod_perl
by aquarium (Curate) on Jul 25, 2010 at 23:34 UTC
    Perl Ajax Frameworks
    There's also HTML::Template, CGI::Application, CGI::Framework, and many other templating frameworks, which help separate code from HTML/presentation layer.
    the hardest line to type correctly is: stty erase ^H
Re: Web Application design patterns with Mod_perl
by derby (Abbot) on Jul 26, 2010 at 12:46 UTC

    Hmmm ... I do MVC web apps all the time and find it actually less complex and easy to implement. Now sure, you can get all academic-y and say it's not really MVC but MVP or MVC model 2 or ... but basically I have a controller (CGI::Application), with home-grown models (Moose and/or traditional blessed hashes), and views (HTML::Template). Even with more-n-more AJAX, I find the MVC model flexible enough to meet my needs (for AJAX, the view shifts from HTML to JSON). What kinds of difficulties are you having?

    -derby
Re: Web Application design patterns with Mod_perl
by bluescreen (Friar) on Jul 26, 2010 at 15:55 UTC

    I agree with you in that Rails's/Catalyst's MVC is hard for complex applications and it is nothing like MVC ( At least what used to be called MVC before the web ). In Web-MVC part of the controller/view ( and sometimes model ) gets located in the client in the form of JavaScript: dynamic menus, form validators, autocomplete fields, etc. In this case the controller/view located in the server has to respond some times HTML and others JSON, XML and even Javascript, if that wasn't enough try to refresh only some parts of the page and it's going to be a big headache. Not only that, if model gets refreshed by another user you won't get updates unless you refresh the page, and we know how frustrating are auto-refreshes from a user stand-point.

    Said that I think it make more sense this days to explore something more close to traditional MVC which is Rich client application ( or Thin Server architecture ) depending on the type of application ( in some other cases old-fashioned web-apps are still better), where a high % of the logic is in the client and server becomes a service and responsibilities are much more delimited. I think cases like Gmail or GrooveShark proved the point.

    For Rich client apps, frameworks like Dojo help a lot in combination with JSON::RPC ( although it completely lacks of session/security management )

Re: Web Application design patterns with Mod_perl
by pemungkah (Priest) on Jul 26, 2010 at 22:50 UTC
    I've seen the following:
    • One handler which dispatches to a bunch of subs in the handler to handle each request. Some shared data in the handler's package globals, mostly transient data which is either written out to a DB or discarded at the end of a transaction.
    • A plugin-like organization, where the URL path is cleaned up and rewritten into a class name; main handler looks to see f the class is loaded and calls a specific method (run(), go() etc.) to execute the request.
    Earlier versions actually generated HTML inline (whee! it's 1990 again!); more current stuff uses a templating system to move off the HTML generation into a separate concern.

    Tangent: Most of the MVC frameworks are inheritance-based, which means you have to understand a lot about what you're subclassing to do that successfully. The Cocoa and Cocoa Touch frameworks get round this by using delegation for most of the application customization; the base framework does almost all of the basic work, while you just write customization code to do your specific stuff. As far as I know there's no OSS equivalent (maybe GNUStep, but that's not a Perl Web framework). If you want to make a name for yourself, there's a big opportunity!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://851264]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (6)
As of 2024-04-19 18:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found