Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

newbie question: Mason, CGI::App, MVC

by nop (Hermit)
on Sep 03, 2002 at 15:45 UTC ( [id://194800]=perlquestion: print w/replies, xml ) Need Help??

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

Hi. I've just started reading about Mason and am getting interested in the technology. My early sense is Mason offers a powerful way to build modular web pages via components. Components can have perl in them, though I agree with the assertion that too much code isn't the best idea. I also see that Mason can interact nicely with apache::session to handle state.

Here's my question: how do folks using Mason handle application logic? I've built a hand-rolled version of CGI::Application that meets my needs and used TT2; do I do the same w/ Mason? Or does Mason have logic routing code aspects to it?

Also, can anyone offer examples / links / suggestions to using Mason in a model-view-controller design?

These are new areas to me; apologies if my question reflects that. Thanks --

nop

Replies are listed 'Best First'.
Re: newbie question: Mason, CGI::App, MVC
by Arguile (Hermit) on Sep 03, 2002 at 16:15 UTC
Re: newbie question: Mason, CGI::App, MVC
by nop (Hermit) on Sep 03, 2002 at 17:25 UTC
    Thanks, Arguile! Perin's article was right on track, and helps me rephrase my question. Perin states:
    The pipeline style does all the work up front in a standard CGI or mod +_perl handler, then decides which template to run and passes some dat +a to it. The template has no control flow logic in it, just presentat +ion logic, e.g. show this graphic if this item is on sale. Popular sy +stems supporting this approach include HTML::Template and Template To +olkit. The callback model works well for publishing-oriented sites where the +pages are essentially mix and match sets of articles and lists. Ideal +ly, a site can be broken down into visual ``components'' or pieces of + pages that are general enough for an HTML coder to recombine them in +to entirely new kinds of pages without any help from a programmer. [snip] The pipeline model is more like a traditional model-view-controller de +sign. Working this way can provide additional performance tuning oppo +rtunities over an approach where you don't know what data will be nee +ded at the beginning of the request. You can aggregate database queri +es, make smarter choices about caching, etc. It can also promote a cl +eaner separation of application logic and presentation. However, this + approach takes longer to get started with since it's a bigger concep +tual hurdle and always involves at least two files: one for the Perl +code and one for the template.
    So my question is:
    am I on the wrong track to consider Mason when I want to use a pipeline model, eg M-V-C?
      <blatent whoring on my part>

      Disclaimer: I'm a big AxKit fan.

      If you are really into the pipeline style of web programming, also take a look at AxKit/Cocoon. They seem to be more geared towards true app logic pipelines instead of templating. Maybe it's just me, and the examples on Mason never stood out as pipelining vs. includes. Could anyone who has used both shed some light?

      Introducing AxKit
      XSP, Taglibs and Pipelines
      Taglib TMTOWTDI

      Getting started is a little slow, but the benefits later are well worth it.

      </blatent whoring on my part>

      Updated: s/Cacoon/Cocoon/

Log In?
Username:
Password:

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

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

    No recent polls found