| 1 | package Samba::LDAP::Base; | ||
| 2 | |||
| 3 | # Returned by Perl::MinimumVersion 0.11 | ||
| 4 | require 5.006; | ||
| 5 | |||
| 6 | 10 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 10 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 10 | ▶ | use base qw(Class::Base); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 0 | ▶ | use Samba::LDAP::Config; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 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 | 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 | my $conf = Samba::LDAP::Config->new(); | ||
| 42 | $conf = $conf->read_conf( $conf->find_smbldap ); | ||
| 43 | |||
| 44 | # Stick them all in $self | ||
| 45 | $self->{$_} = $conf->{$_} for keys %$conf; | ||
| 46 | |||
| 47 | my $bind_conf = $conf->read_conf( $conf->find_smbldap_bind ); | ||
| 48 | |||
| 49 | # Same again | ||
| 50 | $self->{$_} = $bind_conf->{$_} for keys %$bind_conf; | ||
| 51 | |||
| 52 | return $self; | ||
| 53 | } | ||
| 54 | |||
| 55 | #------------------------------------------------------------------------ | ||
| 56 | # module_version() | ||
| 57 | # | ||
| 58 | # Returns the current version number. | ||
| 59 | #------------------------------------------------------------------------ | ||
| 60 | |||
| 61 | sub module_version { | ||
| 62 | my $self = shift; | ||
| 63 | my $class = ref $self || $self; | ||
| 64 | no strict 'refs'; | ||
| 65 | return ${"${class}::VERSION"}; | ||
| 66 | } | ||
| 67 | |||
| 68 | 1; # Magic true value required at end of module | ||
| 69 | __END__ | ||