blib/lib/SQL/Translator/Role/BuildArgs.pm

filter: Statementstmt 100% 12 / 12 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 2 / 2 Podpod n/a totaltotal 100% 16 / 16 SCAR 11.0
CC
3
Cov
100%
__ANON__
3.0
BEGIN
1.0
CRAP 3.0
« blib/lib/SQL/Translator/Parser/Storable.pm ↑ Summary blib/lib/SQL/Translator/Filter/DefaultExtra.pm »
1 package SQL::Translator::Role::BuildArgs;
2  
3 =head1 NAME
4  
5 SQL::Translator::Role::BuildArgs - Remove undefined constructor arguments
6  
7 =head1 SYNOPSIS
8  
9 package Foo;
10 use Moo;
11 with qw(SQL::Translator::Role::BuildArgs);
12  
13 =head1 DESCRIPTION
14  
15 This L<Moo::Role> wraps BUILDARGS to remove C<undef> constructor
16 arguments for backwards compatibility with the old L<Class::Base>-based
17 L<SQL::Translator::Schema::Object>.
18  
19 =cut
20  
21 76 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 around BUILDARGS => sub {
24 3199 ▶ my $orig = shift;
Subroutine __ANON__: called CC=3 SCAR=11.0
25 3199 my $self = shift;
26 3199 my $args = $self->$orig(@_);
27  
28 3199 foreach my $arg (keys %{$args}) {
29 20271 ▶ delete $args->{$arg} unless defined($args->{$arg});
Branch: 1 branch
BranchTrueFalseTotal
unless defined $args->{$arg} 4110 16161 20271
30 }
31 3199 return $args;
32 76 };
33  
34 76 1;
« blib/lib/SQL/Translator/Parser/Storable.pm ↑ Summary blib/lib/SQL/Translator/Filter/DefaultExtra.pm »