blib/lib/DBIO/Test/MooSchema/Result/CD.pm

filter: Statementstmt 100% 21 / 21 Branchbran n/a Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 93.1% 27 / 29 CC 2 SCAR 3.0
CC
2
Cov
96%
_build_full_title
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« blib/lib/DBIO/Test/SQLTracerObj.pm ↑ Summary blib/lib/DBIO/Test/Schema/CD.pm »
1 package DBIO::Test::MooSchema::Result::CD;
2 # ABSTRACT: Moo-enabled test result class for the cd table
3  
4 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 4 our $VERSION = '0.900007';
8  
9 4 ▶use DBIO::Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 4 __PACKAGE__->table('cd');
12 4 __PACKAGE__->add_columns(
13 id => { data_type => 'integer', is_auto_increment => 1 },
14 artist_id => { data_type => 'integer', is_nullable => 0 },
15 title => { data_type => 'varchar', size => 100, is_nullable => 0 },
16 year => { data_type => 'integer', is_nullable => 1 },
17 );
18 4 __PACKAGE__->set_primary_key('id');
19  
20 4 __PACKAGE__->belongs_to(
21 artist => 'DBIO::Test::MooSchema::Result::Artist', 'artist_id'
22 );
23  
24 # Lazy Moo attribute — formatted title including year
25 4 has full_title => ( is => 'lazy' );
26 1 ▶sub _build_full_title {
Subroutine _build_full_title: called CC=2 SCAR=7.1
27 1 my $self = shift;
28 1 ▶ my $year = $self->year // '?';
Condition50%1/2
$self->year // "?"
l!l
10
MC/DC0%0/1
$self->year // "?"
$self->year
Truth table50%1/2
A
A= $self->year
Aresult
11
00
29 1 sprintf '%s (%s)', $self->title, $year;
30 }
31  
32 # Moo rw attribute with lazy default
33 1 ▶has rating => ( is => 'rw', lazy => 1, default => sub { 0 } );
Subroutine __ANON__: called CC=1 SCAR=0.0
34  
35 4 1;
36  
37 __END__
« blib/lib/DBIO/Test/SQLTracerObj.pm ↑ Summary blib/lib/DBIO/Test/Schema/CD.pm »