Heavy.pm

filter: Statementstmt 59.5% 28 / 47 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 8 / 12 Podpod 0.0% 0 / 2 totaltotal 53.7% 36 / 67 CC 4 SCAR 13.9
CC
4
Cov
53%
dispatch_subclass
12.0
__ANON__
6.0
_build_subclass
2.0
CRAP 4.0
« Heavy/Base.pm ↑ Summary Heavy/DBI.pm »
1 package JQuery::DataTables::Heavy;
2 1 ▶use 5.008005;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 our $VERSION = "0.04";
7  
8 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use MooX::Types::MooseLike::Base qw(:all);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use Class::Load ();
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14  
15 1 has subclass => ( is => 'lazy', isa => ConsumerOf [ __PACKAGE__ . '::Base' ] );
16 1 has args => ( is => 'ro', isa => HashRef, required => 1 );
17  
18 0 ▶around BUILDARGS => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
19 0 my $orig = shift;
20 0 my $class = shift;
21 0 my $orig_args = $class->$orig(@_);
22 0 my $args = { args => $orig_args };
23 0 ▶ $args->{subclass} = $args->{subclass} if $args->{subclass};
Branch: 1 branch
BranchTrueFalseTotal
if $args->{"subclass"} 0 0 0
24 0 return $args;
25 1 };
26  
27 0 ▶sub _build_subclass {
Subroutine _build_subclass: not called CC=1 SCAR=6.9
28 0 my ($self) = @_;
29 0 my $subclass = dispatch_subclass( $self->args->{dbh} );
30 0 Class::Load::load_class($subclass);
31 0 return $subclass->new( $self->args );
32 }
33  
34 0 ▶sub dispatch_subclass {
Subroutine dispatch_subclass: not called CC=3 SCAR=24.8
Pod undocumented
35 0 my ($obj) = @_;
36 0 my $subclass = __PACKAGE__;
37 0 ▶ if ( $obj->isa('DBI::db') ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($obj->isa('DBI::db')) { } 0 0 0
elsif ($obj->isa('DBIx::Class::Schema')) { } 0 0 0
38 0 $subclass .= '::DBI';
39 }
40 elsif ( $obj->isa('DBIx::Class::Schema') ) {
41 0 $subclass .= '::DBIC';
42 }
43 else {
44 0 croak( sprintf( "Can't dispatch subclass from args: 'dbh': %s", ref $obj ) );
45 }
46 0 return $subclass;
47 }
48  
49 0 ▶sub table_data {
Subroutine table_data: not called CC=1 SCAR=6.9
Pod undocumented
50 0 my $self = shift;
51 0 $self->subclass->table_data(@_);
52 }
53  
54 1 1;
55  
56 __END__
« Heavy/Base.pm ↑ Summary Heavy/DBI.pm »