#title Development Policy
#author Stefan Hornburg (Racke)
#lang en
#topics Perl, DBIx::Class
#teaser Our development policy for Perl projects and web applications.
** Tests
*** Warnings
Always use [[https://metacpan.org/pod/Test::Warnings][Test::Warnings]] to capture
unexpected warnings in your tests.
use Test::Warnings;
*** Counting tests
use Test::More;
plan tests => 68;
Adjusting the test count every time you are adding tests is an unnecessary hassle,
so just use *done_testing* at the end of your test script:
done_testing;
** DateTime
*** Dates in filenames
#filenamedates
Dates in filenames like =reports/2020-03-08.csv= should be in local time to avoid confusion.
{{{
my $tz = DateTime::TimeZone->new( name => 'local' );
my $now = DateTime->now;
$now->set_time_zone($tz);
}}}
** DBIx::Class
*** Don't die
Use *throw_exception* instead:
$self->throw_exception("This is not a pending cia transaction")
unless $self->is_pending_and_cia;