StateMigrations/SchemaState.pm untested

filter: Statementstmt 0.0% 0 / 36 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 5 Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 53 CC 3 SCAR 18.4
CC
3
Cov
0%
filtered_DiffState
12.0
BEGIN
2.0
BEGIN
2.0
CRAP 6.3
1 package DBIx::Class::StateMigrations::SchemaState;
2  
3 use strict;
4 use warnings;
5  
6 # ABSTRACT: Individual schema state
7  
8 use Moo;
9 use Types::Standard qw(:all);
10  
11  
12 has 'fingerprint', is => 'ro', lazy => 1, default => sub {
13 my $self = shift;
14 die __PACKAGE__ . ' must supply either a checksum "fingerprint" or "DiffState"' unless ($self->DiffState);
15 my $fp = $self->filtered_DiffState->fingerprint;
16 $fp =~ s/\-/_/g;
17 return $fp
18 }, isa => Str;
19  
20 has 'DiffState' => (
21 is => 'ro', lazy => 1,
22 isa => Maybe[InstanceOf['DBIx::Class::Schema::Diff::State']],
23 default => sub { undef }
24 );
25  
26 has 'diff_filters', is => 'ro', default => sub {[]}, isa => ArrayRef;
27  
28 sub filtered_DiffState {
29 my $self = shift;
30
31 my $State = $self->DiffState or return undef;
32 my @chain = @{ $self->diff_filters };
33 while (scalar(@chain) > 0) {
34 my $meth = shift @chain;
35 die "bad diff_filters - argument list must be even" unless (scalar(@chain) > 0);
36
37 die "bad diff_filters method '$meth' - only 'filter' or 'filter_out' supported" unless (
38 $meth eq 'filter' || $meth eq 'filter_out'
39 );
40
41 my $arg = shift @chain;
42 $State = $State->$meth($arg)
43 }
44
45 $State
46 }
47  
48  
49 1;
50  
51 __END__