blib/lib/Pinto/Schema.pm

filter: Statementstmt 70.7% 63 / 89 Branchbran 0.0% 0 / 2 Conditioncond 30.3% 17 / 56 MC/DCmcdc 3.5% 1 / 28 Subroutinesub 62.5% 25 / 40 Podpod 20.0% 1 / 5 totaltotal 48.6% 107 / 220 CC 30 SCAR 13.1
CC
30
Cov
54%
__ANON__
6.1
__ANON__
6.1
__ANON__
6.1
CRAP 3.7
« blib/lib/Pinto/Locator.pm ↑ Summary blib/lib/Pinto/Server/Responder/Action.pm »
1 62 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
2  
3 package Pinto::Schema;
4  
5 # Created by DBIx::Class::Schema::Loader
6 # DO NOT MODIFY THE FIRST PART OF THIS FILE
7  
8 62 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 62 ▶use MooseX::MarkAsMethods autoclean => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 62 extends 'DBIx::Class::Schema';
11  
12 62 __PACKAGE__->load_namespaces;
13  
14 # Created by DBIx::Class::Schema::Loader v0.07015 @ 2012-04-29 01:03:56
15 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:yRlbDgtAuKaDHF9i1Kwqsg
16 #-------------------------------------------------------------------------------
17  
18 # ABSTRACT: The DBIx::Class::Schema for Pinto
19  
20 #-------------------------------------------------------------------------------
21  
22 62 our $VERSION = '0.14'; # VERSION
23  
24 #-------------------------------------------------------------------------------
25  
26 62 ▶use MooseX::SetOnce;
Subroutine BEGIN: called CC=1 SCAR=0.0
27  
28 62 ▶use Pinto::Util qw(decamelize throw);
Subroutine BEGIN: called CC=1 SCAR=0.0
29  
30 #-------------------------------------------------------------------------------
31  
32 62 ▶use Readonly;
Subroutine BEGIN: called CC=1 SCAR=0.0
33 62 Readonly our $SCHEMA_VERSION => 1;
34 1 ▶sub schema_version { return $SCHEMA_VERSION }
Subroutine schema_version: called CC=1 SCAR=0.0
Pod documented
35  
36 #-------------------------------------------------------------------------------
37  
38 62 has repo => (
39 is => 'rw',
40 isa => 'Pinto::Repository',
41 traits => [qw(SetOnce)],
42 weak_ref => 1,
43 );
44  
45 #-------------------------------------------------------------------------------
46  
47 0 ▶sub set_db_version {
Subroutine set_db_version: not called CC=1 SCAR=6.9
Pod undocumented
48 0 my ($self) = @_;
49  
50 # NOTE: SQLite only permits integers for the user_version.
51 # The decimal portion of any float will be truncated.
52 0 my $version = $self->schema_version;
53 0 my $dbh = $self->storage->dbh;
54  
55 0 $dbh->do("PRAGMA user_version = $version");
56  
57 0 return;
58 }
59  
60 #-------------------------------------------------------------------------------
61  
62 0 ▶sub get_db_version {
Subroutine get_db_version: not called CC=1 SCAR=6.9
Pod undocumented
63 0 my ($self) = @_;
64  
65 0 my $dbh = $self->storage->dbh;
66  
67 0 my @version = $dbh->selectrow_array('PRAGMA user_version');
68  
69 0 return $version[0];
70 }
71  
72 #-------------------------------------------------------------------------------
73  
74 0 ▶sub assert_db_version_ok {
Subroutine assert_db_version_ok: not called CC=2 SCAR=17.9
Pod undocumented
75 0 my ($self) = @_;
76  
77 0 my $schema_version = $self->schema_version;
78 0 my $db_version = $self->get_db_version;
79  
80 0 ▶ throw "Database version ($db_version) and schema version ($schema_version) do not match"
Branch: 1 branch
BranchTrueFalseTotal
if $db_version != $schema_version 0 0 0
81 if $db_version != $schema_version;
82  
83 0 return $self;
84 }
85  
86 #-------------------------------------------------------------------------------
87  
88 62 ▶sub resultset_names {
Subroutine resultset_names: called CC=1 SCAR=0.0
Pod undocumented
89 62 my ($class) = @_;
90  
91 62 my @resultset_names = sort keys %{ $class->source_registrations };
92  
93 62 return @resultset_names;
94 }
95  
96 #-------------------------------------------------------------------------------
97  
98 62 for my $rs ( __PACKAGE__->resultset_names ) {
99  
100 ## no critic
101  
102 62 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
103 434 my $rs_decameled = decamelize($rs);
104  
105 434 my $rs_method_name = __PACKAGE__ . "::${rs_decameled}_rs";
106 0 ▶ *{$rs_method_name} = eval "sub { return \$_[0]->resultset('$rs') }";
Subroutine __ANON__: not called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: not called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
107  
108 434 my $create_method_name = __PACKAGE__ . "::create_${rs_decameled}";
109 0 ▶ *{$create_method_name} = eval "sub { return \$_[0]->$rs_method_name->create(\$_[1]) }";
Subroutine __ANON__: not called CC=1 SCAR=0.8
Subroutine __ANON__: called CC=1 SCAR=0.8
Subroutine __ANON__: not called CC=1 SCAR=0.8
Subroutine __ANON__: not called CC=1 SCAR=0.8
Subroutine __ANON__: not called CC=1 SCAR=0.8
Subroutine __ANON__: called CC=1 SCAR=0.8
Subroutine __ANON__: called CC=1 SCAR=0.8
110  
111 434 my $search_method_name = __PACKAGE__ . "::search_${rs_decameled}";
112 0 ▶ *{$search_method_name} = eval "sub { return \$_[0]->$rs_method_name->search(\$_[1] || {}, \$_[2] || {}) }";
Subroutine __ANON__: not called CC=3 SCAR=14.4
Subroutine __ANON__: called CC=3 SCAR=14.4
Subroutine __ANON__: called CC=3 SCAR=14.4
Subroutine __ANON__: not called CC=3 SCAR=14.4
Subroutine __ANON__: called CC=3 SCAR=14.4
Subroutine __ANON__: called CC=3 SCAR=14.4
Subroutine __ANON__: called CC=3 SCAR=14.4
Condition39%11/28
$_[1] || {}
l!l
00
$_[2] || {}
l!l
00
$_[1] || {}
l!l
1180
$_[2] || {}
l!l
0118
$_[1] || {}
l!l
50
$_[2] || {}
l!l
05
$_[1] || {}
l!l
00
$_[2] || {}
l!l
00
$_[1] || {}
l!l
130
$_[2] || {}
l!l
94
$_[1] || {}
l!l
90
$_[2] || {}
l!l
09
$_[1] || {}
l!l
660
$_[2] || {}
l!l
066
MC/DC0%0/1
$_[1] || {}
$_[1]
MC/DC0%0/1
$_[2] || {}
$_[2]
MC/DC0%0/1
$_[1] || {}
$_[1]
MC/DC0%0/1
$_[2] || {}
$_[2]
MC/DC0%0/1
$_[1] || {}
$_[1]
MC/DC0%0/1
$_[2] || {}
$_[2]
MC/DC0%0/1
$_[1] || {}
$_[1]
MC/DC0%0/1
$_[2] || {}
$_[2]
MC/DC0%0/1
$_[1] || {}
$_[1]
MC/DC100%1/1
$_[2] || {}
$_[2]
MC/DC0%0/1
$_[1] || {}
$_[1]
MC/DC0%0/1
$_[2] || {}
$_[2]
MC/DC0%0/1
$_[1] || {}
$_[1]
MC/DC0%0/1
$_[2] || {}
$_[2]
Truth table0%0/2
A
A= $_[1]
Aresult
11
00
Truth table0%0/2
A
A= $_[2]
Aresult
11
00
Truth table50%1/2
A
A= $_[1]
Aresult
11
00
Truth table50%1/2
A
A= $_[2]
Aresult
11
00
Truth table50%1/2
A
A= $_[1]
Aresult
11
00
Truth table50%1/2
A
A= $_[2]
Aresult
11
00
Truth table0%0/2
A
A= $_[1]
Aresult
11
00
Truth table0%0/2
A
A= $_[2]
Aresult
11
00
Truth table50%1/2
A
A= $_[1]
Aresult
11
00
Truth table100%2/2
A
A= $_[2]
Aresult
11
00
Truth table50%1/2
A
A= $_[1]
Aresult
11
00
Truth table50%1/2
A
A= $_[2]
Aresult
11
00
Truth table50%1/2
A
A= $_[1]
Aresult
11
00
Truth table50%1/2
A
A= $_[2]
Aresult
11
00
113  
114 434 my $find_method_name = __PACKAGE__ . "::find_${rs_decameled}";
115 0 ▶ *{$find_method_name} = eval "sub { return \$_[0]->$rs_method_name->find(\$_[1] || {}, \$_[2] || {}) }";
Subroutine __ANON__: not called CC=3 SCAR=18.1
Subroutine __ANON__: not called CC=3 SCAR=18.1
Subroutine __ANON__: not called CC=3 SCAR=18.1
Subroutine __ANON__: not called CC=3 SCAR=18.1
Subroutine __ANON__: called CC=3 SCAR=18.1
Subroutine __ANON__: called CC=3 SCAR=18.1
Subroutine __ANON__: called CC=3 SCAR=18.1
Condition21%6/28
$_[1] || {}
l!l
00
$_[2] || {}
l!l
00
$_[1] || {}
l!l
00
$_[2] || {}
l!l
00
$_[1] || {}
l!l
00
$_[2] || {}
l!l
00
$_[1] || {}
l!l
00
$_[2] || {}
l!l
00
$_[1] || {}
l!l
390
$_[2] || {}
l!l
390
$_[1] || {}
l!l
850
$_[2] || {}
l!l
850
$_[1] || {}
l!l
2290
$_[2] || {}
l!l
0229
MC/DC0%0/1
$_[1] || {}
$_[1]
MC/DC0%0/1
$_[2] || {}
$_[2]
MC/DC0%0/1
$_[1] || {}
$_[1]
MC/DC0%0/1
$_[2] || {}
$_[2]
MC/DC0%0/1
$_[1] || {}
$_[1]
MC/DC0%0/1
$_[2] || {}
$_[2]
MC/DC0%0/1
$_[1] || {}
$_[1]
MC/DC0%0/1
$_[2] || {}
$_[2]
MC/DC0%0/1
$_[1] || {}
$_[1]
MC/DC0%0/1
$_[2] || {}
$_[2]
MC/DC0%0/1
$_[1] || {}
$_[1]
MC/DC0%0/1
$_[2] || {}
$_[2]
MC/DC0%0/1
$_[1] || {}
$_[1]
MC/DC0%0/1
$_[2] || {}
$_[2]
Truth table0%0/2
A
A= $_[1]
Aresult
11
00
Truth table0%0/2
A
A= $_[2]
Aresult
11
00
Truth table0%0/2
A
A= $_[1]
Aresult
11
00
Truth table0%0/2
A
A= $_[2]
Aresult
11
00
Truth table0%0/2
A
A= $_[1]
Aresult
11
00
Truth table0%0/2
A
A= $_[2]
Aresult
11
00
Truth table0%0/2
A
A= $_[1]
Aresult
11
00
Truth table0%0/2
A
A= $_[2]
Aresult
11
00
Truth table50%1/2
A
A= $_[1]
Aresult
11
00
Truth table50%1/2
A
A= $_[2]
Aresult
11
00
Truth table50%1/2
A
A= $_[1]
Aresult
11
00
Truth table50%1/2
A
A= $_[2]
Aresult
11
00
Truth table50%1/2
A
A= $_[1]
Aresult
11
00
Truth table50%1/2
A
A= $_[2]
Aresult
11
00
116  
117 ## use critic
118 }
119  
120 #-------------------------------------------------------------------------------
121  
122 62 __PACKAGE__->meta->make_immutable;
123  
124 #-------------------------------------------------------------------------------
125 62 1;
126  
127 __END__
« blib/lib/Pinto/Locator.pm ↑ Summary blib/lib/Pinto/Server/Responder/Action.pm »