Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Catalyst Help.

by code-ninja (Scribe)
on Feb 11, 2013 at 05:41 UTC ( #1018098=perlquestion: print w/replies, xml ) Need Help??
code-ninja has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks, Before I start you all must know that I'm a bit high... so what if it is a Monday morning? Anyways, I must apologize beforehand for any and all ramblings that will deviate from the topic. Due to some events in the past, right now, unfortunately, I've absurd amounts of free time with me. So I thought I should learn something new and being bored with systems programming in C, I chose web technology. While searching for some helper code in AJAX to load a page asynchronously I ended up reading about Catalyst (don't ask how the hell it happened). I've worked a bit on GoogleAppEngine with Python but since I do not the first word in Python and GoogleAppEngine does not have Perl support yet, I decided I should learn Catalyst. Catalyst begins... I found the tutorial on CPAN and I've been using it to learn Catalyst. It works fine till the point where I've to define my `Model'.

First problem:
script/ model DB DBIC::Schema \ Project2::Schema create=static dbi:mysql:project2

This gave me an error saying DBIC::Schema not found and showed me @INC. So I installed DBIC related packages using my Synaptic. Downloads what seems like a million packages on my very slow broadband connection. Works fine after that. This problem is solved. COOL! Catalyst... me gusta!

Second problem:
So now I start building my `view'. Using Template Toolkit. Server starts fine but the browser gives me a stack trace giving a strange error. The error turns out to be a missing semi-colon near
$c->stash(students => '');

Third problem: Now that I've the model and a view, I start with the controller. Now according to the tutorial it says

$c->stash(students => [$c->model('DB::Students')->all]);

I copy paste the code from tutorial and edit it to fit my needs but when I run, the browser gives some error saying "cannot call method "all" on an undefined value.". I have been on it since 3 days, no luck. I have followed the tutorial word to word with only deviation being that my DB is MySql and NOT SQLite and I'm NOT using the concept of Foreign Keys.

BTW, I'm not a Perl newbie but neither am I a Perl Hacker. I just know enough so that when I speak Perl, a true monk may understand what I have to say. My primary language is C and I'm working on Linux Mint Nadia - Cinnamon (which, IMHO, is freakin' beautiful!) I'm hungry now... to learn Catalyst and refresh my Perl knowledge and some good Indian food will do awesome.


I figured it out... The problem was I got confused. Instead of using the Schema name (which in my case was 'student' and NOT 'students'... the final `s' in the latter) I used the name of the database (Students). Due to this, the stash gets intiated incorrectly (or rather does not get initiated) because


will become an undefined value. This was stupid... 3 days and the only mistake was a goddamn `s'.

Replies are listed 'Best First'.
Re: Catalyst Help.
by Anonymous Monk on Feb 11, 2013 at 06:51 UTC


    You're reading a tutorial of some sort?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1018098]
Approved by rovf
[Discipulus]: Random_Walk maybe you want to reply to the first, original question: that one will be reaped soon

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2018-05-24 08:43 GMT
Find Nodes?
    Voting Booth?