Want to try Catalyst

Catalyst is open-source perl based elegent MVC framework(http://dev.catalystframework.org/wiki/). Check out http://www.perl.com/lpt/a/930 to know more about Catalyst.

Lets see the steps to install catalyst in a easy way.


Download svndump.gz from http://handelframework.com/downloads/
Extract/unzip the items from svndump.gz



For windows:

open a command prompt
-------------------------
  • Goto -> Run->cmd


Change directory to CatInABox/bin
------------------------------------


> cd CatInABox/bin folder
Run catalyst.bat
----------------
Run catalyst.bat along with your Application name. Say my application name is 'Testapp', i would run


> catalyst.bat Testapp
















Now you are done with creating your application. To start the server, change directory to your Testapp/script and start the server.


cd Testapp/script

perl testapp_server.pl
Now your application is up and running. To view it. Goto browser and check
http://localhost:3000 . you should be able to view the application.
For unix flavors:
Repeat the same procedure for unix boxes. Instead of catalyst.bat use catalyst.pl


catalyst.pl Testapp
Which will create the same structure as in windows.



To create a TT view, run:
$ script/testapp_create.pl view TT TT
This creates the lib/Testapp/View/TT.pm module, which is a subclass of Catalyst::View::TT.



To create a new Controller, run:(say i am creating controller User)
$ perl script/testapp_create.pl controller User
This will create "/lib/TestApp/Controller/User.pm" and "/t/controller_user.t"dot(.) t files are used for testing.
To create a database Model
Before creating model, read: http://www.perlmonks.org/?node_id=700283
You need a database, it is recommened to use SQLite, if your application is small. Since its a "embedded" database. so the database exists as a single file and requires no server to run.
$ $ perl script/testapp_create.pl model TestDb DBIC::Schema \ Testapp::Schema::TestDb create=dynamic \ dbi:SQLite:/tmp/database






No comments: