File Coverage

blib/lib/Samba/LDAP/Base.pm
Criterion Covered Total %
statement 26 26 100.0
branch n/a
condition 1 3 33.3
subroutine 7 7 100.0
pod 2 2 100.0
total 36 38 94.7


line stmt bran cond sub pod time code
1             package Samba::LDAP::Base;
2              
3             # Returned by Perl::MinimumVersion 0.11
4             require 5.006;
5              
6 10     10   718 use warnings;
  10         22  
  10         420  
7 10     10   60 use strict;
  10         19  
  10         386  
8 10     10   227 use base qw(Class::Base);
  10         22  
  10         11285  
9 10     10   21539 use Samba::LDAP::Config;
  10         35  
  10         2318  
10              
11             our $VERSION = '0.05';
12              
13             #
14             # Add Log::Log4perl to all our classes!!!!
15             #
16              
17             #========================================================================
18             # -- PUBLIC METHODS --
19             #========================================================================
20              
21             #------------------------------------------------------------------------
22             # init()
23             #
24             # Initialisation method called by the new() constructor and passing a
25             # reference to a hash array containing any configuration items specified
26             # as constructor arguments. Should return $self on success or undef on
27             # error, via a call to the error() method to set the error message.
28             #
29             # We don't use the $config reference yet, still deciding how best to
30             # handle that.
31             #------------------------------------------------------------------------
32              
33             sub init {
34 22     22 1 65906 my ( $self, $config ) = @_;
35              
36             # Do something with $config here later
37              
38             # let's read in smbldap.conf and smbldap_bind.conf and make them
39             # available via $self in every new->();
40             # smbldap.conf
41 22         736 my $conf = Samba::LDAP::Config->new();
42 22         392 $conf = $conf->read_conf( $conf->find_smbldap );
43              
44             # Stick them all in $self
45 22         1600 $self->{$_} = $conf->{$_} for keys %$conf;
46              
47 22         1638 my $bind_conf = $conf->read_conf( $conf->find_smbldap_bind );
48              
49             # Same again
50 22         216 $self->{$_} = $bind_conf->{$_} for keys %$bind_conf;
51              
52 22         276 return $self;
53             }
54              
55             #------------------------------------------------------------------------
56             # module_version()
57             #
58             # Returns the current version number.
59             #------------------------------------------------------------------------
60              
61             sub module_version {
62 1     1 1 1574 my $self = shift;
63 1   33     5 my $class = ref $self || $self;
64 10     10   244 no strict 'refs';
  10         21  
  10         764  
65 1         3 return ${"${class}::VERSION"};
  1         9  
66             }
67              
68             1; # Magic true value required at end of module
69             __END__