File Coverage

lib/Rex/Exporter.pm
Criterion Covered Total %
statement 31 31 100.0
branch 4 6 66.6
condition 4 6 66.6
subroutine 5 5 100.0
pod n/a
total 44 48 91.6


line stmt bran cond sub pod time code
1             #
2             # (c) Jan Gehring
3             #
4              
5             package Rex::Exporter;
6              
7 102     102   1346 use v5.12.5;
  102         385  
8 102     102   456 use warnings;
  102         1131  
  102         3562  
9 102     102   1075 use Symbol;
  102         1037  
  102         7087  
10              
11             our $VERSION = '1.14.3'; # VERSION
12              
13 102     102   696 use Data::Dumper;
  102         381  
  102         29416  
14              
15             our @EXPORT;
16              
17             sub import {
18 3260     3260   56662 my ( $mod_to_register, %option ) = @_;
19 3260         12690 my ( $mod_to_register_in, $file, $line ) = caller;
20              
21 3260 50 66     14956 if ( exists $option{register_in} && $option{register_in} ) {
22 1034         1894 $mod_to_register_in = $option{register_in};
23             }
24              
25 3260         6747 my $no_import = "";
26 3260 50 66     6781 if ( exists $option{"-no"} && $option{"-no"} ) {
27 12         55 $no_import = "," . join( ",", @{ $option{"-no"} } ) . ",";
  12         74  
28             }
29              
30 3260         9819 my $ref_to_export = qualify_to_ref( 'EXPORT', $mod_to_register );
31 3260         76912 my $ref_to_export_array = *{$ref_to_export}{ARRAY};
  3260         6911  
32              
33 3260         4728 for my $reg_func ( @{$ref_to_export_array} ) {
  3260         8238  
34 63646 100       533159 if ( $no_import =~ m/,$reg_func,/ ) {
35 12         62 next;
36             }
37              
38 63634         147611 my $ref_to_reg_func_in_source_mod =
39             qualify_to_ref( $reg_func, $mod_to_register );
40 63634         1070095 my $ref_to_reg_func_in_target_mod =
41             qualify_to_ref( $reg_func, $mod_to_register_in );
42              
43 63634         1039472 *{$ref_to_reg_func_in_target_mod} = *{$ref_to_reg_func_in_source_mod};
  63634         3132629  
  63634         78371  
44             }
45             }
46              
47             1;