File Coverage

blib/lib/MooX/BuildClass/Utils.pm
Criterion Covered Total %
statement 20 20 100.0
branch 4 4 100.0
condition n/a
subroutine 5 5 100.0
pod 2 2 100.0
total 31 31 100.0


line stmt bran cond sub pod time code
1             package MooX::BuildClass::Utils;
2              
3 4     4   30 use strictures 2;
  4         36  
  4         179  
4              
5 4     4   847 use Module::Runtime 'module_notional_filename';
  4         12  
  4         26  
6              
7 4     4   2091 use parent 'Exporter';
  4         1430  
  4         28  
8              
9             our @EXPORT_OK = qw( make_variant_package_name make_variant );
10              
11             our $VERSION = '0.213360'; # VERSION
12              
13             # ABSTRACT: methods for MooX::BuildClass and MooX::BuildRole
14              
15             #
16             # This file is part of Throwable-SugarFactory
17             #
18             #
19             # Christian Walde has dedicated the work to the Commons by waiving all of his
20             # or her rights to the work worldwide under copyright law and all related or
21             # neighboring legal rights he or she had in the work, to the extent allowable by
22             # law.
23             #
24             # Works under CC0 do not require attribution. When citing the work, you should
25             # not imply endorsement by the author.
26             #
27              
28              
29             sub make_variant_package_name {
30 28     28 1 18892 my ( undef, $name ) = @_;
31              
32 28         141 my $path = module_notional_filename $name;
33 28 100       839 die "Won't clobber already loaded: $path => $INC{$path}" if $INC{$path};
34              
35 26         103 return $name;
36             }
37              
38              
39             sub make_variant {
40 26     26 1 21008 my ( $class, undef, undef, @args ) = @_;
41 26         99 while ( @args ) {
42 51         37496 my ( $func, $args ) = ( shift @args, shift @args );
43 51 100       183 $args = [$args] if ref $args ne "ARRAY";
44 51         90 $class->can( $func )->( @{$args} );
  51         289  
45             }
46 26         65695 return;
47             }
48              
49             1;
50              
51             __END__