Branch Coverage

blib/lib/DBIx/MoCo.pm
Criterion Covered Total %
branch 211 312 67.6


line true false branch
97 64 321 if ref $class
105 200 185 if (defined $v) { }
185 0 elsif ($k) { }
107 0 200 if $ex and ref $cache eq 'Cache::Memory'
108 28 172 if ($v eq '') { }
109 28 0 if ($cache->can('remove'))
112 1 27 if ($s)
113 1 0 if $k
116 42 130 if ($class->cache_cols_only and ref $v and ref($v) =~ /::/ and $v->isa($class)) { }
121 84 42 if defined $$v{$_}
126 0 42 if $s
129 13 117 if $s
144 0 26 if (not $self and ref $class)
148 0 26 unless $self
150 16 10 unless $class->cache_object
152 10 0 $class->cache_object->can('remove') ? :
162 3 83 if (not $self and ref $class)
166 0 86 unless $self
171 1 85 if $icache
176 1 124 if ($_[0]) { }
180 107 17 unless $ex > 0
181 5 12 if (not $$self{'_icache'} or $$self{'_icache'}{'_created'} + $ex < time)
191 94 2 unless $$self{'_icache'}
192 0 2 if ($_[0]) { }
202 0 46 unless my $attr = shift()
203 0 46 unless my $oid = $self->object_id
209 0 11 unless my $attr = shift()
219 3 4 if $class->is_in_session
231 0 0 unless my $s = (shift())->session
237 0 6 unless $session
245 102 11 unless $class->is_in_session
247 0 4 unless $_
257 19 193 if (my $db = shift())
274 175 456 if ref $class
275 20 611 unless ($$schema{$class})
288 1 625 if (@_) { }
289 1 0 ref $_[0] && ref $_[0] eq 'ARRAY' ? :
292 1 624 $class->$classdata ? :
307 0 71 unless my $col = shift()
308 1 70 unless $class->columns
319 0 3 unless my $col = shift()
320 0 3 unless my $utf8 = $class->utf8_columns
321 0 3 unless ref $utf8 eq 'ARRAY'
329 366 292 unless ref $self
330 226 432 if ($self and $$self{'object_id'})
335 66 0 unless $class->retrieve_keys
66 366 if ($self and @{$class->primary_keys unless $class->retrieve_keys;}) { }
85 281 elsif ($_[3]) { }
257 24 elsif (@{$class->primary_keys;} == 1) { }
336 0 66 if ($self->has_muid) { }
339 66 0 unless $class->retrieve_keys
340 0 76 unless defined $$self{$_}
343 0 66 unless $key
352 214 43 defined $args[1] ? :
353 214 43 defined $args[1] ? :
354 0 257 if ($col eq 'muid') { }
360 66 366 if $self
366 0 432 if ref $class
376 0 97 unless $_[0]
379 47 50 if (defined $c) { }
386 33 17 if ($o) { }
388 1 32 if $class->is_in_session
392 17 0 if $class->cache_null_object
400 27 23 defined $_[1] ? :
403 33 17 $h ? :
408 0 1 unless my $class = ref $self
409 0 1 unless my $hash = $self->primary_keys_hash
411 0 1 unless my $h = $$res[0]
419 1 26 unless my(@list) = @_
422 0 26 if ($class->cache_object and $class->cache_object->can('get_multi')) { }
428 0 0 $object ? :
435 45 7 $cached_object ? :
446 21 5 if (@cached_objects == @list)
448 0 21 wantarray ? :
464 0 5 if ($class->is_in_session)
473 0 5 wantarray ? :
485 0 52 unless exists $idt{$id}
504 1 1 unless $class->retrieve(%keys)
515 0 4 wantarray ? :
523 6 0 unless $class->retrieve_keys
538 0 26 if ($class->save_explicitly) { }
542 0 26 unless $class->db->insert($class->table, \%args)
544 6 20 unless (defined $args{$pk})
555 9 1 ref $self ? :
556 1 9 unless ref $self
557 0 10 unless $self
559 0 10 unless $self->has_primary_keys
563 0 10 unless defined $args{$_}
565 0 10 unless %args
566 0 10 unless my $res = $class->db->delete($class->table, \%args)
574 0 1 unless ref $args{'where'} eq 'HASH'
579 0 2 unless my $c = $class->cache($oid)
583 0 1 unless $class->db->delete($class->table, $args{'where'})
596 0 21 if $with
598 16 5 wantarray ? :
604 0 0 ref $with && ref $with eq 'ARRAY' ? :
606 0 0 if ($without)
607 0 0 ref $without && ref $without eq 'ARRAY' ? :
613 0 0 unless my $rel = $class->relation->find_relation_by_attr($class, $with_attr)
616 0 0 unless my $key = $$rel{'option'}{'key'}
619 0 0 ref $key && ref $key eq 'HASH' ? :
636 0 7 if ($_[1]) { }
3 4 elsif ($_[0]) { }
653 0 2 if ($_[1]) { }
2 0 elsif ($_[0]) { }
681 11 32 unless ref $self
683 0 43 if $method eq 'DESTROY'
685 8 35 if ($method =~ /^retrieve_by_(.+?)(_or_create)?$/o) { }
7 28 elsif ($method =~ /^(\w+)_as_(\w+)$/o) { }
24 4 elsif (defined $$self{$method} or $class->has_column($method)) { }
687 2 6 $create ? :
702 0 1 if @_ % 2
709 1 1 if (ref $as and ref $as eq 'HASH') { }
711 0 2 if ($$as{$_} and ref $$as{$_} ne 'CODE')
718 1 5 if (@_) { }
719 1 0 $$as{'deflate'} ? :
723 5 0 $$as{'inflate'} ? :
739 99 7 if (my $sub = &$real_can(@_))
744 0 7 if (my $auto = *{$class . '::AUTOLOAD';}{'CODE'})
748 7 0 unless *$AUTOLOAD{'CODE'}
756 7 3 unless ('DBIx::MoCo::Column'->can($as))
759 0 7 if $@
767 0 22 unless my $column = $self->column($colname)
768 6 16 if (my $new = shift())
770 6 0 $column->can($as_string) ? :
780 0 46 unless my $col = shift()
786 0 6 unless my $by = shift()
787 2 4 if ($by =~ /.+_or_.+/) { }
794 3 1 if $o
810 0 2 unless my $by = shift()
823 1 35 if ($class->list_class) { }
825 0 1 if ($@ and not $@ =~ /^Can\'t locate .+? in \@INC/)
850 0 2 unless my $attr = shift()
858 1 127 unless my $class = ref $self
859 0 127 unless defined $_[0]
861 14 113 if (@_ > 1)
862 0 14 if @_ % 2
866 2 12 if ($class->is_in_session) { }
0 12 elsif ($class->save_explicitly) { }
874 0 12 unless my $where = $self->primary_keys_hash
875 0 12 unless %$where
876 0 12 unless $class->db->update($class->table, \%args, $where)
886 0 15 unless my $class = ref $self
887 0 15 unless @{$class->primary_keys;}
890 0 15 unless defined $$self{$_}
906 0 10 unless defined $$self{$_}
914 6 2 unless keys %{$$self{'changed_cols'};}
918 0 2 unless exists $$self{$_}
921 0 2 if ($$self{'to_be_inserted'}) { }
2 0 elsif ($$self{'to_be_updated'}) { }
926 0 2 unless my $where = $self->primary_keys_hash
927 0 2 unless %$where
936 0 97 unless my $class = ref $self
938 97 0 if $self->object_id
940 2 160 unless defined $$self{$key}
941 24 136 unless my $oid = $class->object_id($key, $$self{$key})