blib/lib/DBIO/Test/MooseSchema/Result/Artist.pm

filter: Statementstmt 100% 9 / 9 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 100% 12 / 12 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/DBIO/Test/MooSchema/Result/Artist.pm ↑ Summary blib/lib/DBIO/Test/MooseSchema/Result/CD.pm »
1 package DBIO::Test::MooseSchema::Result::Artist;
2 # ABSTRACT: Moose-enabled test result class for the artist table
3  
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 our $VERSION = '0.900007';
8  
9 2 ▶use DBIO::Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 __PACKAGE__->table('artist');
12 __PACKAGE__->add_columns(
13 id => { data_type => 'integer', is_auto_increment => 1 },
14 name => { data_type => 'varchar', size => 100, is_nullable => 0 },
15 );
16 __PACKAGE__->set_primary_key('id');
17 __PACKAGE__->resultset_class('DBIO::Test::MooseSchema::ResultSet::Artist');
18  
19 __PACKAGE__->has_many(
20 cds => 'DBIO::Test::MooseSchema::Result::CD', 'artist_id'
21 );
22  
23 # Lazy Moose attribute — computed from column data on first access
24 has display_name => (
25 is => 'ro',
26 isa => 'Str',
27 lazy => 1,
28 builder => '_build_display_name',
29 );
30 sub _build_display_name { 'Artist: ' . $_[0]->name }
31  
32 # Moose rw attribute with type constraint and lazy default
33 # (must be lazy — inflate_result bypasses new())
34 has score => ( is => 'rw', isa => 'Int', lazy => 1, default => 0 );
35  
36 __PACKAGE__->meta->make_immutable;
37  
38 1;
39  
40 __END__
« blib/lib/DBIO/Test/MooSchema/Result/Artist.pm ↑ Summary blib/lib/DBIO/Test/MooseSchema/Result/CD.pm »