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   38 use strict;
  6         13  
  6         171  
4 6     6   29 use warnings;
  6         9  
  6         774  
5              
6             #use Moo::Role;
7             #use Moo;
8              
9             sub get_service {
10 8     8 0 38 my (%opts) = @_;
11              
12 8 50       44 my $name = $opts{name} or die "name required";
13 8 50       29 my $auth = ref($opts{auth}) or die "auth required";
14              
15 8         21 my $pkg = ucfirst $name;
16 8         21 $pkg = __PACKAGE__ . "::$pkg";
17              
18 8 50       579 eval qq{ require $pkg; 1 } or die "Failed to load $pkg: $@";
19              
20 8         33 delete $opts{name};
21              
22 8         44 return $pkg->new(%opts);
23             }
24              
25             1;
26              
27             __END__