[Catalyst] Simple literal Model

John M. Dlugosz wxju46gefd at snkmail.com
Fri Feb 25 10:27:51 GMT 2011


  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?

Does 'MyApp_create.pl model' have any built-in stuff to generate a blank ad-hoc model like 
you showed me?

Thanks for the help.

--John





More information about the Catalyst mailing list