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   1391 use v5.12.5;
  102         404  
8 102     102   504 use warnings;
  102         1587  
  102         2605  
9 102     102   2027 use Symbol;
  102         1004  
  102         7479  
10              
11             our $VERSION = '1.14.2.2'; # TRIAL VERSION
12              
13 102     102   692 use Data::Dumper;
  102         198  
  102         30869  
14              
15             our @EXPORT;
16              
17             sub import {
18 3142     3142   59178 my ( $mod_to_register, %option ) = @_;
19 3142         12345 my ( $mod_to_register_in, $file, $line ) = caller;
20              
21 3142 50 66     14978 if ( exists $option{register_in} && $option{register_in} ) {
22 1034         1904 $mod_to_register_in = $option{register_in};
23             }
24              
25 3142         5624 my $no_import = "";
26 3142 50 66     7832 if ( exists $option{"-no"} && $option{"-no"} ) {
27 12         42 $no_import = "," . join( ",", @{ $option{"-no"} } ) . ",";
  12         69  
28             }
29              
30 3142         9915 my $ref_to_export = qualify_to_ref( 'EXPORT', $mod_to_register );
31 3142         74409 my $ref_to_export_array = *{$ref_to_export}{ARRAY};
  3142         6599  
32              
33 3142         4677 for my $reg_func ( @{$ref_to_export_array} ) {
  3142         8490  
34 60224 100       517735 if ( $no_import =~ m/,$reg_func,/ ) {
35 12         64 next;
36             }
37              
38 60212         144322 my $ref_to_reg_func_in_source_mod =
39             qualify_to_ref( $reg_func, $mod_to_register );
40 60212         1029225 my $ref_to_reg_func_in_target_mod =
41             qualify_to_ref( $reg_func, $mod_to_register_in );
42              
43 60212         1027275 *{$ref_to_reg_func_in_target_mod} = *{$ref_to_reg_func_in_source_mod};
  60212         3329064  
  60212         77636  
44             }
45             }
46              
47             1;