[Catalyst] Starting development
Sebastian Willert
willert at gmail.com
Thu Apr 27 20:55:27 CEST 2006
On Thu, 2006-04-27 at 13:33 -0500, Peter Karman wrote:
>
> Guillermo Roditi scribbled on 4/27/06 12:13 PM:
>
> > I have never used Class:DBI or DBIx or anything besides plain DBI
> > because of the nature of the things I develop. Most of the queries are
> > very very complicated and are easier done in plain SQL.
>
> Not using an ORM leaves out the M from the MVC (Model, View, Controller)
> framework that Catalyst uses, which leaves you View and Controller.
> Those two are where all the fun stuff happens anyway. :)
Not at all. You can use model classes for almost any information
retrieval purpose. I even use it for static (or almost static) data,
maybe just because it feels right to do so. Take a look at the example
snipplet I've attached below: this is a model that just returns an array
of hash refs that have been blessed into the class itself (similar to
the way Class::DBI retrieves objects, just for consistency).
Another example where Catalyst just steps out of the way when you don't
need it.
Cheers,
Sebastian
---
package XXX::Model::Publications;
use strict;
use warnings;
use base 'Catalyst::Model';
__PACKAGE__->mk_accessors( qw(pdf_file title topics) );
sub retrieve_all {
my $class = shift;
return [ map{ bless( $_, $class ) } (
{
pdf_file => 'bg 12 papst 04-05.pdf',
title => 'Papstbeilage 04/05',
topics => [
'Karneval in Rom',
'Das Spiel zum Papst',
]
},
{
[...]
}
)];
1;
More information about the Catalyst
mailing list