On Fri, Feb 25, 2011 at 2:27 AM, John M. Dlugosz <[email protected]> wrote:
>  On 2/25/2011 4:06 AM, Tomas Doran bobtfish-at-bobtfish.net |Catalyst/Allow
> to home| wrote:
>>
>> __PACKAGE__->meta->make_immutable;
>> 1;
>>
>> 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).
>>
>> HTH
>> Cheers
>> t0m
>>
> 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
mistake.

-Ashley

_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to