Diff/InfoPacket.pm

filter: Statementstmt 91.4% 32 / 35 Branchbran 90.0% 9 / 10 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 70.0% 7 / 10 Podpod n/a totaltotal 85.0% 51 / 60 CC 7 SCAR 9.5
CC
7
Cov
90%
__ANON__
5.0
__ANON__
2.1
__ANON__
2.0
CRAP 2.6
« Diff/SchemaData.pm ↑ Summary Diff/Schema.pm »
1 package DBIx::Class::Schema::Diff::InfoPacket;
2 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 5 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 5 with 'DBIx::Class::Schema::Diff::Role::Common';
7  
8 5 ▶use Types::Standard qw(:all);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 5 has 'name', required => 1, is => 'ro', isa => Str;
11 0 ▶has 'old_info', is => 'ro', isa => Maybe[HashRef], default => sub { undef };
Subroutine __ANON__: not called CC=1 SCAR=1.2
12 5 has 'new_info', required => 1, is => 'ro', isa => Maybe[HashRef];
13  
14 0 ▶has 'diff_added', is => 'ro', isa => Bool, default => sub { 0 };
Subroutine __ANON__: not called CC=1 SCAR=1.2
15  
16 5 has '_source_diff', required => 1, is => 'ro', isa => InstanceOf[
17 'DBIx::Class::Schema::Diff::Source'
18 ];
19  
20 has 'added', is => 'ro', lazy => 1, default => sub {
21 4203 ▶ my $self = shift;
Subroutine __ANON__: called CC=2 SCAR=7.2
22 4203 ▶ defined $self->new_info && ! defined $self->old_info
Branch: 1 branch
BranchTrueFalseTotal
defined $self->new_info and not defined $self->old_info 4203 0 4203
23 5 }, init_arg => undef, isa => Bool;
24  
25 has 'deleted', is => 'ro', lazy => 1, default => sub {
26 4237 ▶ my $self = shift;
Subroutine __ANON__: called CC=2 SCAR=6.9
27 4237 ▶ defined $self->old_info && ! defined $self->new_info
Branch: 1 branch
BranchTrueFalseTotal
defined $self->old_info and not defined $self->new_info 4192 45 4237
28 5 }, init_arg => undef, isa => Bool;
29  
30  
31 has 'diff', is => 'ro', lazy => 1, default => sub {
32 4237 ▶ my $self = shift;
Subroutine __ANON__: called CC=5 SCAR=16.1
33
34 # There is no reason to diff in the case of added/deleted:
35 4237 ▶ return { _event => 'deleted' } if ($self->deleted);
Branch: 1 branch
BranchTrueFalseTotal
if $self->deleted 34 4203 4237
36 4203 ▶ return { _event => 'added' } if ($self->added && ! $self->diff_added);
Branch: 1 branch
BranchTrueFalseTotal
if $self->added and not $self->diff_added 45 4158 4203
Condition66%2/3
$self->added and not $self->diff_added
!ll&&!rl&&r
4158045
MC/DC50%1/2
$self->added and not $self->diff_added
$self->added not $self->diff_added
Truth table66%2/3
A and not(B)
A= $self->addedB= not $self->diff_added
ABresult
0X0
100
111
37
38 4158 my ($o,$n) = ($self->old_info,$self->new_info);
39 4158 ▶ my $diff = $self->_info_diff($o,$n) or return undef;
Branch: 1 branch
BranchTrueFalseTotal
my $diff = $self->_info_diff($o, $n) or return undef 4090 68 4158
40
41 68 return { _event => 'changed', diff => $diff };
42
43 5 }, init_arg => undef, isa => Maybe[HashRef];
44  
45  
46 0 ▶sub _schema_diff { (shift)->_source_diff->_schema_diff }
Subroutine _schema_diff: not called CC=1 SCAR=6.9
47  
48 5 1;
49  
50 __END__
51  
52 =pod
53  
54 =head1 NAME
55  
56 DBIx::Class::Schema::Diff::InfoPacket - internal object class for DBIx::Class::Schema::Diff
57  
58 =head1 DESCRIPTION
59  
60 This class is used internally by L<DBIx::Class::Schema::Diff> and is not meant to be called directly.
61  
62 Please refer to the main L<DBIx::Class::Schema::Diff> documentation for more info.
63  
64 =head1 AUTHOR
65  
66 Henry Van Styn <vanstyn@cpan.org>
67  
68 =head1 COPYRIGHT AND LICENSE
69  
70 This software is copyright (c) 2014 by IntelliTree Solutions llc.
71  
72 This is free software; you can redistribute it and/or modify it under
73 the same terms as the Perl 5 programming language system itself.
74  
75 =cut
« Diff/SchemaData.pm ↑ Summary Diff/Schema.pm »