| 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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 36 | 4203 | ▶ | return { _event => 'added' } if ($self->added && ! $self->diff_added); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->added and not $self->diff_added
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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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 | ||||||||||||||||||||||||||||