Catalyst 1 Introduction
-
Upload
aran-deltac -
Category
Economy & Finance
-
view
3.491 -
download
0
description
Transcript of Catalyst 1 Introduction
Catalyst Intro
I short introduction to what catalyst is.
Introduction
• A complete web site framework for Perl.
• Comparable to Ruby on Rails and Java Struts.
• Robust and proven.
• Uses and enforces the MVC design pattern.
MVC• MVC is a design pattern that was originally designed for interactive
application development, like Visual Basic.• M is the Model and is generally the database layer.• V is the View and in web development it normally consists of HTML.• C is the Controller which contains all of the business logic written in
Perl/Ruby/PHP/etc.
View
• The view provides an interface for the user to interact with the system.
• The view contains minimal business logic.• The view never modifies the model directly, but it
may read from the model directly.
Controller
• The controller implements all of the business logic.
• The controller prepares information from the model and passes it to the view.
• The controller take data from the view and passes it to the model.
Model
• The model stores the current state of the application.
• The model is manipulated by the controller.
Structure
• A Catalyst app consists of a set of perl modules that all reside under a namespace for that app, such as “MyApp”.– MyApp
This module holds all of the configuration information about the application.
– MyApp::Model::*Contains a class for each type of model being used in this application.
– MyApp::View::*Contains a class for each type of view being used.
– MyApp::Controller::*Contains a class for each controller.
Basic Request Cycle
• A request is made for:http://pets.com/inventory/purchase
• Catalyst finds a handler:Controller::Inventory::Purchase->index()
or, if not found, it looks for:Controller::Inventory->purchase()
• Auto-handlers are executed.• Requested handler is executed.
– Data is gathered from the model.– Model is updated with any changes.
• Handler turns control over to the view.
More on Catalyst
• Supports whatever model classes you want to use such as: Class::DBI, Rose::DB, DBI, DBIx::Class, LDAP
• Supports many different view classes such as: Mason, TT, PHP, EmbPerl
• Has a extensive library of plugins on CPAN.• Large community of users and contributors.• New features in active development (Combust,
Moose).
Resources
• MVC @ Wikipediahttp://en.wikipedia.org/wiki/Model-view-controller
• Catalyst Manual @ CPANhttp://search.cpan.org/~mramberg/Catalyst-Runtime-5.7012/lib/Catalyst/Manual.pm