[Catalyst] Simple literal Model
Ashley Pond V
apv at sedition.com
Fri Feb 25 15:30:17 GMT 2011
On Fri, Feb 25, 2011 at 2:27 AM, John M. Dlugosz <wxju46gefd at snkmail.com> wrote:
> On 2/25/2011 4:06 AM, Tomas Doran bobtfish-at-bobtfish.net |Catalyst/Allow
> to home| wrote:
>> And you then call $c->model('Foo')->data;
>> The implementation of the 'data' method could then later be replaced by an
>> attribute (i.e. has data => ( is => 'ro', isa => 'HashRef' );), and would
>> then get the data from config, or something more complex (e.g. to get the
>> data out of DBI, or another model, or whatever).
> Thanks. Is '$c->model('Foo')->data' what something like DBIC gives us, too?
> That is, is a method named 'data' the convention? That is, if code was
> given a "result set" (I think that is the right term) of a query that was
> made on one of the main standard model types, what would the list of records
> look like?
What t0m suggested is perfectly fine but if you want to mimic the DBIC
API with a different engine, this example does that (superficially and
as a tutorial only): http://sedition.com/a/2739 Log file model–Apache
access log. The reason that example makes sense is because the
underlying model/data is similar: searchable, sortable rows. If you're
trying to shoehorn in something dissimilar, you might be making a
More information about the Catalyst