File Coverage

blib/lib/Attribute/Contract/Modifier/Ensures.pm
Criterion Covered Total %
statement 17 17 100.0
branch 1 2 50.0
condition n/a
subroutine 5 5 100.0
pod 0 1 0.0
total 23 25 92.0


line stmt bran cond sub pod time code
1             package Attribute::Contract::Modifier::Ensures;
2              
3 4     4   20 use strict;
  4         8  
  4         121  
4 4     4   20 use warnings;
  4         5  
  4         119  
5              
6             require Carp;
7 4     4   19 use Attribute::Contract::Utils;
  4         6  
  4         637  
8              
9             sub modify {
10 3     3 0 6 my $class = shift;
11 3         13 my ($package, $name, $code_ref, $import, $attributes) = @_;
12              
13 3 50       11 Carp::croak('Return type(s) are required') unless $attributes;
14              
15 3         12 my $check = build_check(@_);
16              
17             sub {
18 4     4   16403 my @return = $code_ref->(@_);
19              
20 4         33 $check->(@return);
21              
22 1         12 @return;
23 3         22 };
24             }
25              
26             1;