lib/Reaction/InterfaceModel/Reflector/SearchSpec.pm

filter: Statementstmt 35.0% 14 / 40 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 80.0% 4 / 5 Podpod 0.0% 0 / 1 totaltotal 27.6% 18 / 65 CC 9 SCAR 41.4
CC
9
Cov
25%
reflect_attributes_from_target
90.0
BEGIN
1.0
BEGIN
1.0
CRAP 62.6
« lib/Reaction/InterfaceModel/Reflector/DBIC.pm ↑ Summary lib/Reaction/InterfaceModel/Action/DBIC/ResultSet/Create.pm »
1 package Reaction::InterfaceModel::Reflector::SearchSpec;
2  
3 4 ▶use Moose::Exporter;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use Carp qw(confess);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use Reaction::Types::Core qw(SimpleStr NonEmptySimpleStr);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 #use aliased 'T365::BrokerInterface::SearchSpec';
7 4 ▶use aliased 'Moose::Meta::TypeConstraint::Enum';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 0 ▶sub reflect_attributes_from_target {
Subroutine reflect_attributes_from_target: not called CC=9 SCAR=45.0
Pod undocumented
10 0 my ($caller, $foreign) = @_;
11 0 ▶ confess 'Class name to reflect search specification is required as first argument to reflect_attributes_from_target'
Branch: 1 branch
BranchTrueFalseTotal
unless $foreign 0 0 0
12 unless $foreign;
13 # $foreign ||= SearchSpec;
14 0 my $meta = Class::MOP::Class->initialize($caller);
15 0 my %info;
16 0 foreach my $attr (
17 0 grep { $_->name !~ /^_/ }
18 $foreign->meta->get_all_attributes
19 ) {
20 #warn "Doing ".$attr->name;
21 0 my %args;
22 0 { my @copy = qw(required is isa);
23 0 @args{@copy} = @{$attr}{@copy};
24 }
25 0 ▶ if ($args{isa} eq NonEmptySimpleStr) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args{'isa'} eq NonEmptySimpleStr()) { } 0 0 0
26 #warn "here ".$attr->name." ".join(', ', %args);
27 0 ▶ if ($args{required}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args{'required'}) { } 0 0 0
28 0 confess "I really have no idea how we got here";
29 } else {
30 0 $args{isa} = SimpleStr;
31 0 $args{required} = 1;
32 0 ▶ push(@{$info{empty}||=[]}, $attr->name);
Condition0%0/2
$info{"empty"} ||= []
l!l
00
MC/DC0%0/1
$info{"empty"} ||= []
$info{"empty"}
Truth table0%0/2
A
A= $info{"empty"}
Aresult
11
00
33 }
34 } else {
35 0 ▶ push(@{$info{normal}||=[]}, $attr->name);
Condition0%0/2
$info{"normal"} ||= []
l!l
00
MC/DC0%0/1
$info{"normal"} ||= []
$info{"normal"}
Truth table0%0/2
A
A= $info{"normal"}
Aresult
11
00
36 #warn "here instead ".$attr->name;
37 }
38 0 my $tc;
39 0 ▶ if (($tc = $args{type_constraint}) && ($tc->isa(Enum))) {
Branch: 1 branch
BranchTrueFalseTotal
if ($tc = $args{"type_constraint"} and $tc->isa("Moose::Meta::TypeConstraint::Enum")) 0 0 0
Condition0%0/3
$tc = $args{"type_constraint"} and $tc->isa("Moose::Meta::TypeConstraint::Enum")
!ll&&!rl&&r
000
MC/DC0%0/2
$tc = $args{"type_constraint"} and $tc->isa("Moose::Meta::TypeConstraint::Enum")
$tc = $args{"type_constraint"} $tc->isa("Moose::Meta::TypeConstraint::Enum")
Truth table0%0/3
A and B
A= $tc = $args{"type_constraint"}B= $tc->isa("Moose::Meta::TypeConstraint::Enum")
ABresult
0X0
100
111
40 0 $args{valid_values} = $tc->values;
41 }
42 0 $args{predicate} = "has_".$attr->name;
43 0 $meta->add_attribute($attr->name => \%args);
44 }
45 0 \%info;
46 }
47  
48 4 Moose::Exporter->setup_import_methods(
49 with_caller => [ 'reflect_attributes_from_target' ]
50 );
51  
52 4 1;
53  
« lib/Reaction/InterfaceModel/Reflector/DBIC.pm ↑ Summary lib/Reaction/InterfaceModel/Action/DBIC/ResultSet/Create.pm »