Thursday, July 10, 2008

Speed Reading Problems - Catalyst, DBIx

I'm a speed reader and unfortunately miss things, if you find yourself here you just might be a speed reader too ^^ Or perhaps you just intentionally don't read things :) I've spent too much time on figuring out the following when I could have just re-read the documentation. That's what I ended up doing anyhow.

My static files aren't accessible in the root url, where are they?

Catalyst static files can be accessed by specifying static in the URL path, I thought it would default to the root path, silly me.

http://hostname:3000/static/index.html

And I also had to add the following in my Root.pm to get it to serve and index.html file

my $file_path = '/TimeApp/root/static/index.html';
$c->serve_static_file($file_path);

Apache does it when I'm not developing but restarting Apache after every code change is a real drag.....

I can't access my DBIx alias column using the object notation

i.e.

'+select' => [{ extract => 'epoch FROM me.create_date'}],
'+as' => ['timestamp_date'],
.....
$c->log->info("create_date" . $record->timestamp_date;



It specifies in the documentation to use get_column for alias columns

Shameless copy, paste and alter from the DBIx Cookbook

'If on the other hand the alias does not correspond to an existing column, you have to fetch the value using the get_column accessor:

my $name_length = $record->get_column('create_date');'



I'm sure had I asked on IRc mst would have crucified me.
:)

0 comments: