Catalyst 1 Introduction

10
Catalyst Intro I short introduction to what catalyst is.

description

 

Transcript of Catalyst 1 Introduction

Page 1: Catalyst 1   Introduction

Catalyst Intro

I short introduction to what catalyst is.

Page 2: Catalyst 1   Introduction

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.

Page 3: Catalyst 1   Introduction

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.

Page 4: Catalyst 1   Introduction

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.

Page 5: Catalyst 1   Introduction

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.

Page 6: Catalyst 1   Introduction

Model

• The model stores the current state of the application.

• The model is manipulated by the controller.

Page 7: Catalyst 1   Introduction

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.

Page 8: Catalyst 1   Introduction

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.

Page 9: Catalyst 1   Introduction

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

Page 10: Catalyst 1   Introduction

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