| 1 | package DBIx::Model::DB; | ||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use Type::Tiny; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Types::Standard qw/ArrayRef Int Str Undef/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use DBIx::Model::Table; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 1 | our $VERSION = '0.0.1'; | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | my $Table = Type::Tiny->new( | ||||||||||||||||||||||||||||
| 11 | name => 'Table', | ||||||||||||||||||||||||||||
| 12 | 0 | ▶ | constraint => sub { ref($_) eq 'table' }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 13 | 0 | ▶ | message => sub { "$_ ain't a table" }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 14 | 1 | ); | |||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | our $INLINE = { | ||||||||||||||||||||||||||||
| 17 | catalog => { | ||||||||||||||||||||||||||||
| 18 | is => 'ro', | ||||||||||||||||||||||||||||
| 19 | isa => Str | Undef, | ||||||||||||||||||||||||||||
| 20 | }, | ||||||||||||||||||||||||||||
| 21 | chains => { | ||||||||||||||||||||||||||||
| 22 | is => 'rw', | ||||||||||||||||||||||||||||
| 23 | isa => Int, | ||||||||||||||||||||||||||||
| 24 | }, | ||||||||||||||||||||||||||||
| 25 | _tables => { | ||||||||||||||||||||||||||||
| 26 | is => 'ro', | ||||||||||||||||||||||||||||
| 27 | isa => ArrayRef [$Table], | ||||||||||||||||||||||||||||
| 28 | 0 | ▶ | default => sub { [] }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 29 | }, | ||||||||||||||||||||||||||||
| 30 | 1 | name => { | |||||||||||||||||||||||||||
| 31 | is => 'ro', | ||||||||||||||||||||||||||||
| 32 | isa => Str, | ||||||||||||||||||||||||||||
| 33 | required => 1, | ||||||||||||||||||||||||||||
| 34 | }, | ||||||||||||||||||||||||||||
| 35 | schema => { | ||||||||||||||||||||||||||||
| 36 | is => 'ro', | ||||||||||||||||||||||||||||
| 37 | isa => Str | Undef, | ||||||||||||||||||||||||||||
| 38 | }, | ||||||||||||||||||||||||||||
| 39 | table_types => { | ||||||||||||||||||||||||||||
| 40 | is => 'ro', | ||||||||||||||||||||||||||||
| 41 | isa => Str, | ||||||||||||||||||||||||||||
| 42 | }, | ||||||||||||||||||||||||||||
| 43 | }; | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 0 | ▶ | sub add_table { | ||||||||||||||||||||||||||
|
Subroutine
add_table: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 46 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 47 | 0 | my $table = DBIx::Model::Table->new( @_, db => $self ); | |||||||||||||||||||||||||||
| 48 | 0 | push( @{ $self->_tables }, $table ); | |||||||||||||||||||||||||||
| 49 | 0 | return $table; | |||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 0 | ▶ | sub tables { | ||||||||||||||||||||||||||
|
Subroutine
tables: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 53 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 54 | 0 | ▶ | return @{ $self->_tables } if wantarray; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 55 | 0 | return $self->_tables; | |||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 0 | ▶ | sub as_string { | ||||||||||||||||||||||||||
|
Subroutine
as_string: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 59 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 60 | 0 | my $str = $self->name; | |||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 0 | foreach my $table ( $self->tables ) { | |||||||||||||||||||||||||||
| 63 | 0 | $str .= "\n" . $table->as_string(' '); | |||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 0 | return $str; | |||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | ### DO NOT EDIT BELOW! (generated by Class::Inline v0.0.1) | ||||||||||||||||||||||||||||
| 70 | #<<< | ||||||||||||||||||||||||||||
| 71 | 0 | ▶ | require Carp;our@ATTRS_UNEX=(undef);sub new {my$class=shift;my$self={@_ ? @_ | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=10 SCAR=44.7
Pod
undocumented
| |||||||||||||||||||||||||||||
| 72 | 0 | ▶ | > 1 ? @_ : %{$_[0]}: ()};map {local$Carp::CarpLevel=$Carp::CarpLevel + 1; | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 73 | Carp::croak("missing attribute DBIx::Model::DB::$_ is required")unless | ||||||||||||||||||||||||||||
| 74 | 0 | ▶ | exists$self->{$_}}'name';if (@ATTRS_UNEX){map {local$Carp::CarpLevel= | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 75 | 0 | $Carp::CarpLevel + 1;Carp::carp("DBIx::Model::DB attribute '$_' unexpected") | |||||||||||||||||||||||||||
| 76 | 0 | ;delete$self->{$_ }}sort grep {not exists$INLINE->{$_ }}keys %$self}else { | |||||||||||||||||||||||||||
| 77 | 0 | @ATTRS_UNEX=map {delete$self->{$_ };$_}grep {not exists$INLINE->{$_ }}keys % | |||||||||||||||||||||||||||
| 78 | 0 | ▶ | $self}bless$self,ref$class || $class;map {$self->{$_ }=eval {$INLINE->{$_ } | ||||||||||||||||||||||||||
|
Condition0%0/3
ref $class || $class
MC/DC0%0/2
ref $class || $class
ref $class
$class
Truth table0%0/3
A || B
A= ref $classB= $class
| |||||||||||||||||||||||||||||
| 79 | 0 | ▶ | ->{'isa'}->($self->{$_ })};Carp::croak( | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 80 | 0 | qq{DBIx::Model::DB::$_ value invalid ($@)})if $@}grep {exists$self->{$_ }} | |||||||||||||||||||||||||||
| 81 | 0 | '_tables','catalog','chains','name','schema','table_types';my@check=( | |||||||||||||||||||||||||||
| 82 | 0 | ▶ | 'DBIx::Model::DB');my@parents;while (@check){no strict 'refs';my$c=shift | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=2.2
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 83 | 0 | @check;push@parents,@{$c .'::ISA'};push@check,@{$c .'::ISA'}}map {$_->BUILD( | |||||||||||||||||||||||||||
| 84 | 0 | ▶ | )if exists &{$_.'::BUILD'}}reverse@parents;$self->BUILD()if exists &{'BUILD' | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 85 | 0 | ▶ | };$self}sub __ro {my (undef,undef,undef,$sub)=caller(1);local | ||||||||||||||||||||||||||
|
Subroutine
__ro: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 86 | 0 | ▶ | $Carp::CarpLevel=$Carp::CarpLevel + 1;Carp::croak( | ||||||||||||||||||||||||||
|
Condition0%0/2
$_[1] // "undef"
MC/DC0%0/1
$_[1] // "undef"
$_[1]
Truth table0%0/2
A
A= $_[1]
| |||||||||||||||||||||||||||||
| 87 | "attribute $sub is read-only (value: '" .($_[1]// 'undef')."')")}sub _tables | ||||||||||||||||||||||||||||
| 88 | 0 | ▶ | {$_[0]->__ro($_[1])if @_ > 1;$_[0]{'_tables'}//= eval {$INLINE->{'_tables'} | ||||||||||||||||||||||||||
|
Subroutine
_tables: not called CC=4 SCAR=30.0
Branch: 1 branch
Condition0%0/3
$_[0]{"_tables"} //= eval {
do {
$DBIx::Model::DB::INLINE->{"_tables"}{"isa"}->($DBIx::Model::DB::INLINE->{"_tables"}{"default"}->($_[0]))
}
}
MC/DC0%0/2
$_[0]{"_tables"} //= eval {
do {
$DBIx::Model::DB::INLINE->{"_tables"}{"isa"}->($DBIx::Model::DB::INLINE->{"_tables"}{"default"}->($_[0]))
}
}
$_[0]{"_tables"}
eval {
do {
$DBIx::Model::DB::INLINE->{"_tables"}{"isa"}->($DBIx::Model::DB::INLINE->{"_tables"}{"default"}->($_[0]))
}
}
Truth table0%0/3
A //= B
A= $_[0]{"_tables"}B= eval {
do {
$DBIx::Model::DB::INLINE->{"_tables"}{"isa"}->($DBIx::Model::DB::INLINE->{"_tables"}{"default"}->($_[0]))
}
}
| |||||||||||||||||||||||||||||
| 89 | 0 | ▶ | ->{'isa'}->($INLINE->{'_tables'}->{'default'}->($_[0]))};Carp::croak( | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 90 | 'invalid (DBIx::Model::DB::_tables) default value: ' .$@)if $@;$_[0]{ | ||||||||||||||||||||||||||||
| 91 | 0 | ▶ | '_tables'}}sub catalog {$_[0]->__ro($_[1])if @_ > 1;$_[0]{'catalog'}// undef | ||||||||||||||||||||||||||
|
Subroutine
catalog: not called CC=3 SCAR=24.8
Pod
undocumented
Branch: 1 branch
Condition0%0/2
$_[0]{"catalog"} // undef
MC/DC0%0/1
$_[0]{"catalog"} // undef
$_[0]{"catalog"}
Truth table0%0/2
A
A= $_[0]{"catalog"}
| |||||||||||||||||||||||||||||
| 92 | 0 | ▶ | }sub chains {if (@_ > 1){$_[0]{'chains'}=eval {$INLINE->{'chains'}->{'isa'} | ||||||||||||||||||||||||||
|
Subroutine
chains: not called CC=4 SCAR=30.0
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 93 | 0 | ▶ | ->($_[1])};Carp::croak('invalid (DBIx::Model::DB::chains) value: '.$@)if $@; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 94 | 0 | ▶ | return $_[0]}$_[0]{'chains'}// undef}sub name {$_[0]->__ro($_[1])if @_ > 1; | ||||||||||||||||||||||||||
|
Subroutine
name: not called CC=2 SCAR=17.9
Pod
undocumented
Branch: 1 branch
Condition0%0/2
$_[0]{"chains"} // undef
MC/DC0%0/1
$_[0]{"chains"} // undef
$_[0]{"chains"}
Truth table0%0/2
A
A= $_[0]{"chains"}
| |||||||||||||||||||||||||||||
| 95 | 0 | ▶ | $_[0]{'name'}}sub schema {$_[0]->__ro($_[1])if @_ > 1;$_[0]{'schema'}// | ||||||||||||||||||||||||||
|
Subroutine
schema: not called CC=3 SCAR=24.8
Pod
undocumented
Branch: 1 branch
Condition0%0/2
$_[0]{"schema"} // undef
MC/DC0%0/1
$_[0]{"schema"} // undef
$_[0]{"schema"}
Truth table0%0/2
A
A= $_[0]{"schema"}
| |||||||||||||||||||||||||||||
| 96 | 0 | ▶ | undef}sub table_types {$_[0]->__ro($_[1])if @_ > 1;$_[0]{'table_types'}// | ||||||||||||||||||||||||||
|
Subroutine
table_types: not called CC=3 SCAR=24.8
Pod
undocumented
Branch: 1 branch
Condition0%0/2
$_[0]{"table_types"} // undef
MC/DC0%0/1
$_[0]{"table_types"} // undef
$_[0]{"table_types"}
Truth table0%0/2
A
A= $_[0]{"table_types"}
| |||||||||||||||||||||||||||||
| 97 | undef} | ||||||||||||||||||||||||||||
| 98 | #>>> | ||||||||||||||||||||||||||||
| 99 | ### DO NOT EDIT ABOVE! (generated by Class::Inline v0.0.1) | ||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | 1 | 1; | |||||||||||||||||||||||||||