File Coverage

blib/lib/OpenStack/MetaAPI/API.pm
Criterion Covered Total %
statement 14 14 100.0
branch 3 6 50.0
condition n/a
subroutine 3 3 100.0
pod 0 1 0.0
total 20 24 83.3


line stmt bran cond sub pod time code
1             package OpenStack::MetaAPI::API;
2              
3 6     6   45 use strict;
  6         17  
  6         174  
4 6     6   36 use warnings;
  6         14  
  6         916  
5              
6             #use Moo::Role;
7             #use Moo;
8              
9             sub get_service {
10 8     8 0 48 my (%opts) = @_;
11              
12 8 50       38 my $name = $opts{name} or die "name required";
13 8 50       31 my $auth = ref($opts{auth}) or die "auth required";
14              
15 8         24 my $pkg = ucfirst $name;
16 8         25 $pkg = __PACKAGE__ . "::$pkg";
17              
18 8 50       658 eval qq{ require $pkg; 1 } or die "Failed to load $pkg: $@";
19              
20 8         36 delete $opts{name};
21              
22 8         51 return $pkg->new(%opts);
23             }
24              
25             1;
26              
27             __END__