| 1 | package DBIx::Class::Schema::Diff::InfoPacket; | ||||||||||
| 2 | 4 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 4 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 4 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 4 | with 'DBIx::Class::Schema::Diff::Role::Common'; | |||||||||
| 7 | |||||||||||
| 8 | 4 | ▶ | use Types::Standard qw(:all); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 4 | has 'name', required => 1, is => 'ro', isa => Str; | |||||||||
| 11 | 4 | has 'old_info', required => 1, is => 'ro', isa => Maybe[HashRef]; | |||||||||
| 12 | 4 | has 'new_info', required => 1, is => 'ro', isa => Maybe[HashRef]; | |||||||||
| 13 | |||||||||||
| 14 | 4 | has '_source_diff', required => 1, is => 'ro', isa => InstanceOf[ | |||||||||
| 15 | 'DBIx::Class::Schema::Diff::Source' | ||||||||||
| 16 | ]; | ||||||||||
| 17 | |||||||||||
| 18 | has 'added', is => 'ro', lazy => 1, default => sub { | ||||||||||
| 19 | 4237 | ▶ | my $self = shift; | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||
| 20 | 4237 | ▶ | defined $self->new_info && ! defined $self->old_info | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | 4 | }, init_arg => undef, isa => Bool; | |||||||||
| 22 | |||||||||||
| 23 | has 'deleted', is => 'ro', lazy => 1, default => sub { | ||||||||||
| 24 | 4192 | ▶ | my $self = shift; | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.2
| |||||||||||
| 25 | 4192 | ▶ | defined $self->old_info && ! defined $self->new_info | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | 4 | }, init_arg => undef, isa => Bool; | |||||||||
| 27 | |||||||||||
| 28 | |||||||||||
| 29 | has 'diff', is => 'ro', lazy => 1, default => sub { | ||||||||||
| 30 | 4237 | ▶ | my $self = shift; | ||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
| |||||||||||
| 31 | |||||||||||
| 32 | # There is no reason to diff in the case of added/deleted: | ||||||||||
| 33 | 4237 | ▶ | return { _event => 'added' } if ($self->added); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 34 | 4192 | ▶ | return { _event => 'deleted' } if ($self->deleted); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 35 | |||||||||||
| 36 | 4158 | my ($o,$n) = ($self->old_info,$self->new_info); | |||||||||
| 37 | 4158 | ▶ | my $diff = $self->_info_diff($o,$n) or return undef; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 38 | |||||||||||
| 39 | 68 | return { _event => 'changed', diff => $diff }; | |||||||||
| 40 | |||||||||||
| 41 | 4 | }, init_arg => undef, isa => Maybe[HashRef]; | |||||||||
| 42 | |||||||||||
| 43 | |||||||||||
| 44 | 0 | ▶ | sub _schema_diff { (shift)->_source_diff->_schema_diff } | ||||||||
|
Subroutine
_schema_diff: not called CC=1 SCAR=6.9
| |||||||||||
| 45 | |||||||||||
| 46 | 4 | 1; | |||||||||
| 47 | |||||||||||
| 48 | __END__ | ||||||||||