File Coverage

blib/lib/Kavorka/TraitFor/Parameter/optional.pm
Criterion Covered Total %
statement 11 11 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 15 15 100.0


line stmt bran cond sub pod time code
1 8     8   4266 use 5.014;
  8         19  
2 8     8   26 use strict;
  8         8  
  8         219  
3 8     8   25 use warnings;
  8         14  
  8         497  
4              
5             package Kavorka::TraitFor::Parameter::optional;
6              
7             our $AUTHORITY = 'cpan:TOBYINK';
8             our $VERSION = '0.037';
9              
10 8     8   31 use Moo::Role;
  8         9  
  8         46  
11              
12             around _injection_default_value => sub
13             {
14             my $next = shift;
15             my $self = shift;
16             @_ = ('undef') unless @_;
17             $self->$next(@_);
18             };
19              
20              
21             after sanity_check => sub
22             {
23             my $self = shift;
24             my $name = $self->name;
25             croak("Bad parameter $name") if $self->invocant;
26             };
27              
28             1;