Navigator/Node/DBIDM.pm

filter: Statementstmt 62.2% 33 / 53 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 62.5% 10 / 16 Podpod 100% 1 / 1 totaltotal 55.0% 44 / 80 CC 4 SCAR 12.5
CC
4
Cov
55%
MOUNT
12.0
_attributes
6.0
_children
2.0
CRAP 3.5
« Navigator/App/PerlDebug.pm ↑ Summary Navigator/Node/DBI.pm »
1 package Tree::Navigator::Node::DBIDM;
2 1 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶use DBI;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use DBIx::DataModel;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Params::Validate qw/validate/;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 extends 'Tree::Navigator::Node';
11  
12  
13 0 ▶sub MOUNT {
Subroutine MOUNT: not called CC=3 SCAR=24.8
Pod documented
14 0 my ($class, $mount_args) = @_;
15 0 ▶ my @mount_point = %{$mount_args->{mount_point} || {}};
Condition0%0/2
$mount_args->{'mount_point'} || {}
l!l
00
MC/DC0%0/1
$mount_args->{'mount_point'} || {}
$mount_args->{'mount_point'}
Truth table0%0/2
A
A= $mount_args->{'mount_point'}
Aresult
11
00
16 0 $mount_args->{mount_point} = validate(@mount_point , {
17 schema => {isa => 'DBIx::DataModel::Schema'},
18 });
19  
20 $mount_args->{mount_point}{schema}->dbh
21 0 ▶ or die "schema has no dbh";
Branch: 1 branch
BranchTrueFalseTotal
$mount_args->{"mount_point"}{"schema"}->dbh or die "schema has no dbh" 0 0 0
22 }
23  
24  
25 0 ▶sub _children {
Subroutine _children: not called CC=1 SCAR=6.9
26 0 my $self = shift;
27 0 return [qw/Table Row/];
28 }
29  
30  
31 0 ▶sub _child {
Subroutine _child: not called CC=1 SCAR=6.9
32 0 my ($self, $child_path) = @_;
33 0 my $class = ref $self;
34 0 my $subclass = $class . "::" . $child_path;
35 0 return $subclass->new(mount_point => $self->mount_point,
36 path => $child_path);
37 }
38  
39 0 ▶sub _attributes {
Subroutine _attributes: not called CC=2 SCAR=17.9
40 0 my $self = shift;
41 0 my $schema = $self->mount_point->{schema};
42 return {class => (ref $schema || $schema),
43 0 ▶ dbh => $schema->dbh->{Name}};
Condition0%0/3
ref $schema || $schema
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $schema || $schema
ref $schema $schema
Truth table0%0/3
A || B
A= ref $schemaB= $schema
ABresult
1X1
011
000
44 }
45  
46  
47 1 __PACKAGE__->meta->make_immutable;
48  
49 package Tree::Navigator::Node::DBIDM::Tables;
50 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
51 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
52  
53 0 ▶sub _children {
Subroutine _children: not called CC=1 SCAR=6.9
54 0 my $self = shift;
55 0 my $schema = $self->mount_point->{schema};
56 0 return [map {$_->name} $schema->meta->tables];
57 }
58  
59 0 ▶sub _child {
Subroutine _child: not called CC=1 SCAR=6.9
60 0 my ($self, $child_name) = @_;
61 0 return Tree::Navigator::Node::DBIDM::Table->new(
62 mount_point => $self->mount_point,
63 path => ($self->path . "/" . $child_name),
64 );
65 }
66  
67 package Tree::Navigator::Node::DBIDM::Table;
68 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
69 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
70  
71  
72  
73  
74 1 1; # End of Tree::Navigator::Node::DBIDM
75  
76  
77 __END__
« Navigator/App/PerlDebug.pm ↑ Summary Navigator/Node/DBI.pm »