File Coverage

blib/lib/MooX/Role/Parameterized/With.pm
Criterion Covered Total %
statement 26 26 100.0
branch 1 2 50.0
condition 2 3 66.6
subroutine 8 8 100.0
pod n/a
total 37 39 94.8


line stmt bran cond sub pod time code
1             package MooX::Role::Parameterized::With;
2 8     8   581624 use v5.12;
  8         37  
3 8     8   66 use strict;
  8         20  
  8         281  
4 8     8   47 use warnings;
  8         18  
  8         749  
5              
6             our $VERSION = '0.701'; # VERSION
7              
8             # ABSTRACT: dsl to apply roles with composition parameters
9              
10 8     8   55 use Carp qw(carp);
  8         17  
  8         589  
11 8     8   2025 use MooX::Role::Parameterized qw();
  8         22  
  8         699  
12              
13             sub import {
14 14     14   9837 my $target = caller;
15              
16             {
17 14         131 my $orig = $target->can('with');
  14         171  
18 14 50 66     99 carp "will redefine 'with' function"
19             if $orig && $MooX::Role::Parameterized::VERBOSE;
20              
21 8     8   54 no strict 'refs';
  8         14  
  8         331  
22 8     8   42 no warnings 'redefine';
  8         14  
  8         867  
23              
24 14         99 *{ $target . '::with' } =
  14         11258  
25             MooX::Role::Parameterized->build_apply_roles_to_package($orig);
26             }
27             }
28              
29             1;
30              
31             __END__