blib/lib/Yeb/Plugin/DBIC.pm

filter: Statementstmt 93.1% 41 / 44 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 78.5% 11 / 14 Podpod 0.0% 0 / 1 totaltotal 86.8% 53 / 61 CC 4 SCAR 4.7
CC
4
Cov
91%
BUILD
3.0
_build_schema
2.0
__ANON__
2.0
CRAP 1.6
↑ Summary
1 package Yeb::Plugin::DBIC;
2 2 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 $Yeb::Plugin::DBIC::AUTHORITY = 'cpan:GETTY';
4 }
5 # ABSTRACT: Yeb Plugin for DBIx::Class
6 2 $Yeb::Plugin::DBIC::VERSION = '0.001';
7 2 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use DBIx::Class;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use Safe::Isa;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶use Module::Runtime qw( use_module );
Subroutine BEGIN: called CC=1 SCAR=0.0
12
13 2 has app => ( is => 'ro', required => 1 );
14 2 has class => ( is => 'ro', required => 1 );
15  
16 2 has schema_from => ( is => 'ro', required => 1, init_arg => 'schema' );
17 0 ▶has connect => ( is => 'lazy', builder => sub {[]} );
Subroutine _build_connect: called CC=1 SCAR=0.4
Subroutine __ANON__: not called CC=1 SCAR=0.4
18  
19 2 has schema => ( is => 'lazy', init_arg => undef );
20  
21 1 ▶sub _build_schema {
Subroutine _build_schema: called CC=2 SCAR=7.0
22 1 my ( $self ) = @_;
23 1 ▶ return $self->schema_from if $self->schema_from->$_isa('DBIx::Class::Schema');
Branch: 1 branch
BranchTrueFalseTotal
if $self->schema_from->$Yeb::Plugin::DBIC::_isa("DBIx::Class::Schema") 0 1 1
24 1 my @args = @{$self->connect};
25 1 use_module($self->schema_from);
26 1 return $self->schema_from->connect(@args);
27 }
28  
29 1 ▶sub BUILD {
Subroutine BUILD: called CC=3 SCAR=11.1
Pod undocumented
30 1 my ( $self ) = @_;
31 1 ▶ $self->app->register_function('schema',sub { $self->schema });
Subroutine __ANON__: called CC=1 SCAR=0.0
32 1 ▶ my $resultset_sub = sub { $self->schema->resultset(@_) };
Subroutine __ANON__: called CC=1 SCAR=0.0
33 1 $self->app->register_function('resultset',$resultset_sub);
34 1 $self->app->register_function('rs',$resultset_sub);
35 1 for my $schema_function (qw(
36 source
37 sources
38 storage
39 schema_version
40 )) {
41 0 ▶ $self->app->register_function($schema_function,sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
42 0 $self->schema->$schema_function(@_);
43 4 });
44 }
45 1 for my $storage_function (qw(
46 txn_do
47 txn_scope_guard
48 txn_begin
49 txn_commit
50 txn_rollback
51 )) {
52 0 ▶ $self->app->register_function($storage_function,sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
53 0 $self->schema->storage->$storage_function(@_);
54 5 });
55 }
56 }
57  
58 2 1;
59  
60 __END__
↑ Summary