November 2013 Archives

Simplifying imports (mainly in tests)

During test writing often I find myself having to use a lot of modules and setting up various things that should be common for all of my tests in a given project. In some examples it may get ugly and I really don't like having a ~30 lines long setup in every single test file of mine. After some experimenting, I came up with a quick-and-dirty solution. I create a module in my 't' directory (let's say t/lib/Test/MyApp.pm) and put everything I need into it's import sub:


package Test::MyApp;

sub import {
use v5.16;
use strict;

Post #1

Hello everyone, this is my first post here.
I'm fairly new to Perl (~1 year experience) and to testing. I'd like to write not so much articles, but short, to the point code snippets with comments that are useful for those, who are new to Perl, DBIx::Class, PerlDancer2 and testing.
I will try to post things that I would like to know when I started out, but could not find them.

About Davs

user-pic About my journey with Perl, PerlDancer2, DBIx::Class and testing.