blib/lib/UR/Role/MethodModifier/Before.pm untested

filter: Statementstmt 0.0% 0 / 20 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 31 SCAR 24.8
CC
3
Cov
0%
create_wrapper_sub
12.0
type
2.0
BEGIN
2.0
CRAP 12.0
1 package UR::Role::MethodModifier::Before;
2 use strict;
3 use warnings;
4  
5 our $VERSION = "0.46"; # UR $VERSION;
6  
7 use UR;
8  
9 UR::Object::Type->define(
10 class_name => 'UR::Role::MethodModifier::Before',
11 is => 'UR::Role::MethodModifier',
12 );
13  
14 sub type { 'before' }
15  
16 sub create_wrapper_sub {
17 my($self, $original_sub) = @_;
18  
19 my $before = $self->code;
20 return sub {
21 if (wantarray) {
22 () = $before->(@_);
23 } elsif (defined wantarray) {
24 my $rv = $before->(@_);
25 } else {
26 $before->(@_);
27 }
28 $original_sub->(@_);
29 };
30 }
31  
32 1;