Showing posts with label catalyst. Show all posts
Showing posts with label catalyst. Show all posts

Thursday, April 24, 2008

Creating a controller in Catalyst

A new controller in Catalyst is registered by running script/APPNAME_create.pl CONTROLLER_NAME. This creates a module in the controller directory and a test in the test directory. These are apparently all that is needed for a controller to be created.

It's worth noting that /foo can activate either App::Controller::Foo::index() or App::Controller::Root::foo(). However, if both exist, App::Controller::Foo::index() takes precedence.

Friday, April 18, 2008

Learning Catalyst: The Backlog project. Day 1

The Plan

What I'm looking to build is a web application which is designed for maintaining a product backlog. I see the following as the key user stories:
  • As a programmer, I want the system to use the wiki as its primary display and authentication system (so, users will log into Backlog using their wiki credentials, and the backlog is visible from the wiki).
  • As a programmer, I want the system to import the existing backlog from the wiki.
  • As a User, I want to be able to submit stories to the product backlog.
  • As a product owner, I want to be able to prioritize and arrange the backlog.


Installing Catalyst

This went far more easily than I expected. A simple CPAN install brought it in with no problems. I guess I was just lucky on that front.

Building the core

Step one was to build the core of the application. I ran catalyst.pl from the command line and got the following:

~/dev/Backlog> catalyst.pl Backlog
To use the Catalyst development tools including catalyst.pl and the
generated script/myapp_create.pl you need Catalyst::Helper, which is
part of the Catalyst-Devel distribution. Please install this via a
vendor package or by running one of -

perl -MCPAN -e 'install Catalyst::Devel'
perl -MCPANPLUS -e 'install Catalyst::Devel'


Apparently the Catalyst package is divided into two parts, one just for running Catalyst, one for developing Catalyst applications. Fortunately this install was also uneventful.

Rerunning it, I got

~/dev/Backlog> catalyst.pl Backlog
created "Backlog"
created "Backlog/script"
created "Backlog/lib"
created "Backlog/root"
created "Backlog/root/static"
created "Backlog/root/static/images"
created "Backlog/t"
created "Backlog/lib/Backlog"
created "Backlog/lib/Backlog/Model"
created "Backlog/lib/Backlog/View"
created "Backlog/lib/Backlog/Controller"
created "Backlog/backlog.yml"
created "Backlog/lib/Backlog.pm"
created "Backlog/lib/Backlog/Controller/Root.pm"
created "Backlog/README"
created "Backlog/Changes"
created "Backlog/t/01app.t"
created "Backlog/t/02pod.t"
created "Backlog/t/03podcoverage.t"
created "Backlog/root/static/images/catalyst_logo.png"
created "Backlog/root/static/images/btn_120x50_built.png"
created "Backlog/root/static/images/btn_120x50_built_shadow.png"
created "Backlog/root/static/images/btn_120x50_powered.png"
created "Backlog/root/static/images/btn_120x50_powered_shadow.png"
created "Backlog/root/static/images/btn_88x31_built.png"
created "Backlog/root/static/images/btn_88x31_built_shadow.png"
created "Backlog/root/static/images/btn_88x31_powered.png"
created "Backlog/root/static/images/btn_88x31_powered_shadow.png"
created "Backlog/root/favicon.ico"
created "Backlog/Makefile.PL"
created "Backlog/script/backlog_cgi.pl"
created "Backlog/script/backlog_fastcgi.pl"
created "Backlog/script/backlog_server.pl"
created "Backlog/script/backlog_test.pl"
created "Backlog/script/backlog_create.pl"

running ./Backlog/script/backlog_server.pl started up the web server on port 3000 and I was able to verify that I had a working Catalyst application to begin playing with.