In this chapter, we looked at alternate ways to access the data model. We first added the ability to execute raw SQL to a standard DBIC model, and contrasted the code with normal DBIC resultset access. Then, we completely eliminated DBIC and wrote a database Model that used DBI to run raw SQL on the database. Next, we created a Filesystem model from scratch, and learned how to use COMPONENT
and ACCEPT_CONTEXT
to integrate the Model with the Catalyst application. We also saw how using Catalyst::Model::Adaptor
made writing a maintainable Model easier. Remember that the best practice is to always have the definition and behavior of the data in the model, which allows for the Controller to become a glue and as thin. The View can then be independent to render the data.
18.117.230.81