File Coverage

blib/lib/Chef.pm
Criterion Covered Total %
statement 16 26 61.5
branch 5 14 35.7
condition n/a
subroutine 4 7 57.1
pod 2 7 28.5
total 27 54 50.0


line stmt bran cond sub pod time code
1             #--------------------------------------------------------------------#
2             # Class : Chef #
3             # @author : Bhavin Patel #
4             #--------------------------------------------------------------------#
5              
6             package Chef;
7             $Chef::VERSION = 1.0;
8              
9             sub new {
10 4     4 0 14066 my $class = shift;
11 4         14 my $param = {@_};
12 4         12 my $self = {};
13              
14 4         16 bless $self, $class;
15 4 50       24 $self->server( $param->{'chef_server'} ) if defined $param->{'chef_server'};
16 4 50       15 $self->chef_version( $param->{'chef_version'} ) if defined $param->{'chef_version'};
17 4         18 return $self;
18              
19             sub server {
20 1     1 0 5 my ($self,$server) = (@_);
21 1 50       10 $self->{ 'CHEF_SERVER' } = $server if defined $server;
22 1         15 return $self->{ 'CHEF_SERVER' };
23             }
24             sub chef_version {
25 1     1 1 10 my ($self,$chef_version) = (@_);
26 1 50       5 $self->{ 'CHEF_VERSION' } = $chef_version if defined $chef_version;
27 1         12 return $self->{ 'CHEF_VERSION' };
28             }
29             sub host_port {
30 0     0 0 0 my $self = shift;
31 0         0 my $server = $self->server;
32 0         0 $server =~ m/^(http|https):\/\/(.*)(:(\d))?/;
33 0         0 return "$2";
34             }
35             sub organization_name {
36 0     0 1 0 my ($self,$organization_name) = (@_);
37 0 0       0 $self->{ 'ORGANIZATION_NAME' } = $organization_name if defined $organization_name;
38 0         0 return $self->{ 'ORGANIZATION_NAME' };
39             }
40             sub hosted_chef {
41 0     0 0 0 my ($self,$hosted_chef) = (@_);
42 0 0       0 $self->{ 'HOSTED_CHEF_' } = $hosted_chef if defined $server;;
43 0         0 return $self->{ 'HOSTED_CHEF' };
44             }
45            
46             sub private_key {
47 2     2 0 5 my ($self,$private_key) = (@_);
48 2 50       13 $self->{ 'CHEF_CLIENT_PRIVATE_KEY' } = $private_key if defined $private_key;
49 2         238 return $self->{ 'CHEF_CLIENT_PRIVATE_KEY' };
50             }
51             }#nwe
52              
53             __DATA__