Learn ORM in Perl with DBIx::Class

Posted on February 6, 2017. Filed under: Uncategorized | Tags: , , , , , , |

This post will provide a brief hands-on introduction to ORM in Perl using a few DBIx::Class sub classes.

In detail, this means we will generate Schema, Result and ResultSet classes (Perl modules) which will be used to interface with a SQLite database. The database will contain a single users table. Once the database has been created, we will implement functionality to both return the full name of a user, and find all users under a given age. To ensure the functionality of the schema, this code will be implemented using Test Driven Development (TDD), where the tests will be written first, then made to pass as we add new functionality.

This article is divided into two parts. The first part is doing the groundwork — installing Perl modules, setting up the directory structure, the database to test against, and a unit test against which we can measure our progress. In the second part we will create a database and use DBIx::Class modules to make the tests pass.

part 1 — installing Perl modules, setting up the directory structure, the database to test against, and a unit test against which we can measure our progress.

part 2 — creating a database and using DBIx::Class modules to make the tests pass.

Liked it here?
Why not try sites on the blogroll...