Catalyst (software)
Encyclopedia
Catalyst is an open source
Open source
The term open source describes practices in production and development that promote access to the end product's source materials. Some consider open source a philosophy, others consider it a pragmatic methodology...

 web application framework
Web application framework
A web application framework is a software framework that is designed to support the development of dynamic websites, web applications and web services. The framework aims to alleviate the overhead associated with common activities performed in Web development...

 written in Perl
Perl
Perl is a high-level, general-purpose, interpreted, dynamic programming language. Perl was originally developed by Larry Wall in 1987 as a general-purpose Unix scripting language to make report processing easier. Since then, it has undergone many changes and revisions and become widely popular...

, that closely follows the model–view–controller (MVC) architecture, and supports a number of experimental web patterns. It is written using Moose
Moose (Perl)
Moose is an extension of the Perl 5 object system. It brings modern object-oriented language features to Perl 5, making object-oriented programming more consistent and less tedious.-Features:...

, a modern object system for Perl. Its design is heavily inspired by such frameworks as Ruby on Rails
Ruby on Rails
Ruby on Rails, often shortened to Rails or RoR, is an open source web application framework for the Ruby programming language.-History:...

, Maypole
Maypole framework
Maypole is a Perl web application framework for MVC-oriented applications. Maypole is designed to minimize coding requirements for creating simple web interfaces to databases, while remaining flexible enough to support enterprise web applications...

, and Spring.

A web application developer would use Catalyst to deal with code common to all web applications: it provides interfaces to web servers and receiving page requests, dispatching these into developer-written code to process and return the requests, and provides a standardised interface for data models, authentication, session management and other common web application elements.

All of these elements are implemented as plugins to a set of common interfaces, allowing the developer to change the specific method used (e.g. a session storing in shared memory versus as a database table, or using FastCGI versus operating as an within Apache's mod_perl) by changing the configuration of Catalyst to use a different plugin without altering the application code.

Catalyst is primarily distributed through the CPAN
CPAN
CPAN, the Comprehensive Perl Archive Network, is an archive of nearly 100,000 modules of software written in Perl, as well as documentation for it. It has a presence on the World Wide Web at and is mirrored worldwide at more than 200 locations...

, which is the official distribution channel for Perl libraries and applications.

History

Catalyst's first development release took place on 28 January 2005. The first official version hit CPAN on 16 February 2005. As of June 2011, Catalyst has 201 registered contributors.

Philosophy

Catalyst is based on a "don't repeat yourself
Don't repeat yourself
In software engineering, Don't Repeat Yourself is a principle of software development aimed at reducing repetition of information of all kinds, especially useful in multi-tier architectures...

" (DRY) principle, which means that definitions should only have to be made once.

Catalyst can be used with automatic class loading from the database through one of the many loader modules, thus requiring no code for the database layer. But, if you require the flexibility of manually doing everything, it's also an option. Another guiding principle of Catalyst is flexibility.

Catalyst promotes the re-use of existing Perl modules that already handle common web application concerns well.
  • The Model part is handled through DBIx::Class
    DBIx::Class
    DBIx::Class is an object-relational mapper for Perl. It is used to map relational database table rows to Perl objects and generates SQL queries transparently to the application developer. It is popular in Web application frameworks such as Catalyst.-See also:* DBI* Other object-relational mappers...

    , Plucene, Net::LDAP and other model classes.
  • The View layer is usually handled by Template Toolkit
    Template Toolkit
    The Template Toolkit is a template engine used primarily for building web sites, but is also suitable for creating any type of digital document, such as a PDF or LaTeX file. Template Toolkit is based on a mini-language and does not allow direct Perl in its templates, unlike some competing products...

    , Mason
    Mason (Perl)
    HTML::Mason, or Mason for short, is a web application framework written in Perl. It is distributed on CPAN.Its features make it a suitable backend for high load sites serving dynamic content, such as online newspapers or database driven e-commerce sites. The author claims that several popular web...

    , or HTML::Template, among others.
  • The Controller layer is of course written by each application author. Large chunks of Controller functionality can usually be deferred to one of the many Catalyst plugins (e.g., Catalyst::Plugin::FormValidator, Catalyst::Plugin::Prototype, Catalyst::Plugin::Account::AutoDiscovery, etc.).
  • Finally, Catalyst offers a set of helpers to simplify flow control and mapping URLs to controller methods.


Catalyst has a large selection of plugins. For example, it has JavaScript generation for Ajax
Ajax (programming)
Ajax is a group of interrelated web development methods used on the client-side to create asynchronous web applications...

 and RIA
Rich Internet application
A Rich Internet Application is a Web application that has many of the characteristics of desktop application software, typically delivered either by way of a site-specific browser, via a browser plug-in, independent sandboxes, extensive use of JavaScript, or virtual machines...

s using the Catalyst::Plugin::Prototype module (prototype
Prototype Javascript Framework
The Prototype JavaScript Framework is a JavaScript framework created by Sam Stephenson in February 2005 as part of the foundation for Ajax support in Ruby on Rails. It is implemented as a single file of JavaScript code, usually named prototype.js...

 is an Ajax framework
Ajax framework
In web application development, an Ajax framework is a framework which leverages Ajax, a collection of technologies for building dynamic web pages on the client side...

). Plugins cover many areas, for example authentication, session management, HTTP negotiation and REST.

Catalyst can also be used with other Ajax frameworks such as jQuery
JQuery
jQuery is a cross-browser JavaScript library designed to simplify the client-side scripting of HTML. It was released in January 2006 at BarCamp NYC by John Resig...

 or YUI, the Yahoo!
Yahoo!
Yahoo! Inc. is an American multinational internet corporation headquartered in Sunnyvale, California, United States. The company is perhaps best known for its web portal, search engine , Yahoo! Directory, Yahoo! Mail, Yahoo! News, Yahoo! Groups, Yahoo! Answers, advertising, online mapping ,...

 User Interface Library.

Web server support

For development and testing, Catalyst has a built-in simple HTTP server. For production use, Apache
Apache HTTP Server
The Apache HTTP Server, commonly referred to as Apache , is web server software notable for playing a key role in the initial growth of the World Wide Web. In 2009 it became the first web server software to surpass the 100 million website milestone...

, lighttpd
Lighttpd
lighttpd is an open-source web server more optimized for speed-critical environments than common products while remaining standards-compliant, secure and flexible...

 or Nginx
Nginx
nginx is a Web server and a reverse proxy server for HTTP, SMTP, POP3 and IMAP protocols, with a strong focus on high concurrency, performance and low memory usage. It is licensed under a BSD-like license and it runs on Unix, Linux, BSD variants, Mac OS X, Solaris, and Microsoft Windows.- Overview...

 with FastCGI
FastCGI
FastCGI is a protocol for interfacing interactive programs with a web server. FastCGI is a variation on the earlier Common Gateway Interface ; FastCGI's main aim is to reduce the overhead associated with interfacing the web server and CGI programs, allowing a server to handle more web page...

 or mod perl
Mod perl
mod_perl is an optional module for the Apache HTTP server. It embeds a Perl interpreter into the Apache server, so that dynamic content produced by Perl scripts can be served in response to incoming requests, without the significant overhead of re-launching the Perl interpreter for each request...

 support is recommended, but any web server with CGI or FastCGI support will work. On Apache, mod_perl can help with performance considerably, though its use might be an issue because it can be unsafe to share multiple applications under mod_perl.

Since early 2008, Catalyst applications can also be deployed using the HTTP::Prefork engine which provides for the deployment of high performance Catalyst applications without a separate web server.

Database support

Catalyst can run using any database supported by Perl's DBI
Perl DBI
In computing, the Perl DBI offers a standardized way for programmers using the Perl programming language to embed database communication within their programs. The latest DBI module for Perl from CPAN can run on a range of operating systems....

 (this means almost anything, even a CSV
Comma-separated values
A comma-separated values file stores tabular data in plain-text form. As a result, such a file is easily human-readable ....

 file), but a proper RDBMS or ODBMS is recommended. The database access is entirely abstracted
Database abstraction layer
A database abstraction layer is an application programming interface which unifies the communication between a computer application and databases such as SQL Server, DB2, MySQL, PostgreSQL, Oracle or SQLite...

 from the programmer's point of view and Catalyst, through one of its model classes, handles access to all databases automatically – though, if needed, using direct SQL
SQL
SQL is a programming language designed for managing data in relational database management systems ....

 queries is possible. This enables database-neutrality, application portability over different database systems, and usability of pre-existing databases for Catalyst application development as much as possible, though due to different feature sets of the RDBMSes, it is not completely guaranteed by the framework alone. Several different RDBMS systems are supported, including MySQL
MySQL
MySQL officially, but also commonly "My Sequel") is a relational database management system that runs as a server providing multi-user access to a number of databases. It is named after developer Michael Widenius' daughter, My...

, PostgreSQL
PostgreSQL
PostgreSQL, often simply Postgres, is an object-relational database management system available for many platforms including Linux, FreeBSD, Solaris, MS Windows and Mac OS X. It is released under the PostgreSQL License, which is an MIT-style license, and is thus free and open source software...

, SQLite
SQLite
SQLite is an ACID-compliant embedded relational database management system contained in a relatively small C programming library. The source code for SQLite is in the public domain and implements most of the SQL standard...

, IBM DB2
IBM DB2
The IBM DB2 Enterprise Server Edition is a relational model database server developed by IBM. It primarily runs on Unix , Linux, IBM i , z/OS and Windows servers. DB2 also powers the different IBM InfoSphere Warehouse editions...

, Oracle
Oracle database
The Oracle Database is an object-relational database management system produced and marketed by Oracle Corporation....

 and Microsoft SQL Server
Microsoft SQL Server
Microsoft SQL Server is a relational database server, developed by Microsoft: It is a software product whose primary function is to store and retrieve data as requested by other software applications, be it those on the same computer or those running on another computer across a network...

. For ODBMSes, there is explicit support for KiokuDB via Catalyst::Model::KiokuDB. The Model abstraction allows databases of any nature to be accessed via Catalyst::Model::Adaptor.

Many Catalyst-based projects use DBIx::Class
DBIx::Class
DBIx::Class is an object-relational mapper for Perl. It is used to map relational database table rows to Perl objects and generates SQL queries transparently to the application developer. It is popular in Web application frameworks such as Catalyst.-See also:* DBI* Other object-relational mappers...

 as the ORM layer
Object-relational mapping
Object-relational mapping in computer software is a programming technique for converting data between incompatible type systems in object-oriented programming languages. This creates, in effect, a "virtual object database" that can be used from within the programming language...

, which provides further abstraction of SQL queries, using a resultset-based API with transparent support for arbitrary joins and other features.

Uses

Websites powered by Catalyst include YouPorn
YouPorn
YouPorn is a free pornographic video sharing website. Since starting in August 2006, it has become the most popular pornographic website. In November 2007, it was reported to be the largest free pornographic website on the Internet...

 and Magazines.com
Magazines.com
Magazines.com LLC is a privately held American e-commerce company based in Franklin, TN, a suburb of Nashville, Tennessee. Magazines.com retains authorizations to sell magazine subscriptions by publishers and is the largest online independent agent of magazine subscriptions. Time Inc. is a major...

.
The MojoMojo wiki engine is written using Catalyst.

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK