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 CC 3 SCAR 9.2
CC
3
Cov
100%
__ANON__
3.0
BEGIN
1.0
CRAP 2.5
« blib/lib/SQL/Translator/Role/Debug.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 77 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 3406 ▶around BUILDARGS => sub {
Subroutine __ANON__: called CC=3 SCAR=11.0
24 3406 my $orig = shift;
25 3406 my $self = shift;
26 3406 my $args = $self->$orig(@_);
27  
28 3406 foreach my $arg (keys %{$args}) {
29 20662 ▶ delete $args->{$arg} unless defined($args->{$arg});
Branch: 1 branch
BranchTrueFalseTotal
unless defined $args->{$arg} 4114 16548 20662
30 }
31 3406 return $args;
32 77 };
33  
34 77 1;
« blib/lib/SQL/Translator/Role/Debug.pm ↑ Summary blib/lib/SQL/Translator/Filter/DefaultExtra.pm »