Getting started with Catalyst Framework (install)

I’ve been a fan of Ruby on Rails for a while. I’ve not been able to find a hosting solution that keeps on the bleeding edge of Rails development. Most hosts are 2 or 3 years behind, which makes it very difficult to keep your site updated with the latest gems.

I found myself asking, “Why is that?” The answer is pretty simple: Rails has strict conventions. Those conventions tie you into developing on the framework. I have a similar issue currently at work where I’ve worked with PHP in the past, so it was assumed I would quickly and easily pick up on Drupal. For those of you who don’t know, drupal is a fairly large content management system with hooks and interfaces to the core which make it very easy to create modules. And, yet, you’re locked into that convention and tied into whatever modules you devour.

In the case of Ruby, it’s not really ‘difficult’ to make modifications, but doing so can quickly break the mantra of the framework. It’s not really fragile.. stubborn maybe? In Drupal’s case, in order to modify something being done at the core, you have to right a module which uses hooks or other callbacks. If you need to modify a module, you have to write another module. The code you write for Drupal can’t easily be extracted and used elsewhere (unlike Ruby’s gems).

The other day, I came across the Catalyst Framework. I’ve been reading about perl, and hoping to familiarize myself with it. There’s no better time than now.

Here are the steps I’ve taken for getting started with Catalyst Framework, a perl MVC framework.

  1. Install ‘cpan’: sudo apt-get install cpan
  2. Install ‘perl-doc’:

     $ sudo apt-get install perl-doc
  3. Start ‘cpan’:

      $ cpan 
  4. Set policy to follow:

    	    cpan[1]> o conf prerequisites_policy follow
    	    cpan[2]> o conf commit
            
  5. install cpanm:

     $ curl -L http://cpanmin.us | perl - --sudo App::cpanminus 
  6. Install ‘YAML’:

     $ cpanm --sudo YAML 	
  7. Install ‘Catalyst::Manual’:

     $ cpanm --sudo Catalyst::Manual  
  8. To view the manual, run:

     $ perldoc Catalyst::Manual 

    or.. install Pod::Browser and run it. There is a nice JavaScript-enabled user interface.

        $ cpanm --sudo Pod::Browser
        $ pod_browser_server.pl
      
  9. Install ‘Catalyst::Runtime’ and ‘Catalyst::Devel’ via cpanm:

                
       $ cpanm --sudo Catalyst::Runtime
       $ cpanm --sudo Catalyst::Devel
       
  10. Scaffold your application:

        $ catalyst.pl MyApp
        $ cd MyApp
        $ script/myapp_create.pl controller Library::Login
      

    That last line generates a login controller…

  11. run this test application:

     $ script/myapp_server.pl 
  12. navigate to http://localhost:3000

Next Steps

  • Install a Perl IDE. I’ve chosen EPIC (an eclipse plugin) to start off with.
    a. Open Eclipse and go to Install New Software
    b. Add the site: ‘http://e-p-i-c.sf.net/updates/testing’
    c. Choose the main application and install it.
  • Read through documentation in Catalyst::Manual

Flattr this!