Mailing List Archive

How to understand the relation of TT and dojo and Plack
Hi:
Everyone! I haven't get the all stack of Catalyst application.
An application have so many functions. Some is done by some component, and some function can be done by application code.
I have get the TT and dojo and Plack, may be. It will entry-level.

Can anyone illustrate three concepts or terms? Especially there relations? For example, why should we use Plack, and not use old fastcgi?

You are welcome!


Thai Heng
Re: How to understand the relation of TT and dojo and Plack [ In reply to ]
Thai,

Catalyst, unlike a framework like say Ruby on Rails, sits at the center of a number of other Perl technologies.  You named a few, such as Plack/PSGI, Template Toolkit, etc.  Others might include DBIx::Class for interfacing with a database.  And of course any number of testing tools on the Test::* namespace.  As a result you have to put together a stack that makes sense to you, although one of the more common ones would be those mentioned.

Plack is an implementation of the PSGI specification, which connections a web application (such as Catalyst) to a web server, such as Nginx, Apache, Starman, etc.  This glue layer is reusable across many web frameworks, so we all work on it together for the betterment of all.  Plack also implements common middleware for concerns that are cross cutting, such as session and cookie management, authentication, etc.  Some web frameworks make heavy use of middleware, such as Web::Simple, while Catalyst tends to mix and match between middleware and pre-existing Catalyst specific components.  For example, Catalyst has its own mature session and authentication components, so we tend to use that rather than the Plack middleware (although over time I'd personally like to move towards using more middleware).

Template Toolkit (TT) is a templating system which is a common choice for a View layer in Catalyst.  It allows you a more cleanly expressive approach to the concern of how your web pages look.  Quite often you will use a Javascript framework, such as Dojo, Jquery or Angular.js to name a few of the ones I am personally familiar with.  Javascript will be integrated into the View (TT).  Catalyst, unlike some web frameworks, doesn't offer a lot of Javascript code generation tools since most Perl programmers prefer a more hands on approach and write their Javascript manually.  Catalyst offers some tools for interacting with a Javascript application, such as support for JSON.  So using Javascript with Catalyst is totally fine, just as I said compared to some frameworks you might find yourself needing to write a bit more manual code.  As I said, Perl programmers tend to like to be 'close to the metal' so that is reflected in how Catalyst works.

I recommend you look at a few Catalyst applications on Github and review the tutorial if you can.



On Saturday, December 14, 2013 6:04 PM, 疾驰者 <78778487@qq.com> wrote:

Hi:
   Everyone!  I haven't get the all stack of Catalyst application.
   An application have so many functions. Some is done by some component, and some function can be done by application code.
   I have get the TT and dojo and Plack, may be. It will entry-level.

   Can anyone illustrate three concepts or terms? Especially there relations? For example, why should we use Plack, and not use old fastcgi?

--
FastCGI is great, and my first choice for production systems.  Plack implements PSGI and offers you a way to integrate a server such as FastCGI with your Catalyst web application.  It also lets you 'glue' that same application to a different server.  For example, many people use Starman as a server for development be cause its very easy to setup, but use something else in production (although Starman if run behind a proxy can be solid in production as well and some people choose that setup).

[client web browser] <--> [Apache <--> FastCGI] <--> [Plack FastCGI Handler <--> Catalyst <--> DBIx::Class <--> Database]

^^ is one example stack.  

Here's a great blog of someone that started with Catalyst from the start and he did his best to record the journey.  Maybe it will help you.

http://blogs.perl.org/users/j0e/

Also, I recommend reading the current and past Advent Calendars:

http://www.catalystframework.org/calendar/


   You are welcome!

Best of luck! --jnap

                                                                                                Thai Heng

_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/