package Samba::LDAP;
use version; $VERSION = qv('0.0.1');
use warnings;
use strict;
use Carp;
use Class::Std::Utils;
use File::Basename;
use base qw(File::Samba);
{
# Attributes
my %config_of;
# Constructor takes the path of the Samba config file
sub new {
my ($class, $samba) = @_;
# Bless a scalar to instantiate the new object...
my $new_object = bless anon_scalar(), $class;
# Initialise the object's "config" attribute...
$config_of{ident $new_object} = $samba;
return $new_object;
}
sub get_path {
my ($self) = @_;
return $config_of{ident $self};
}
sub get_filename {
my ($self) = @_;
my $filename = basename($config_of{ident $self});
return $filename;
}
}
1;
####
use strict;
use warnings;
use Samba::LDAP;
my $smbconf = Samba::LDAP->new(q{/etc/samba/smb.conf});
# path is loaded
my $path = $smbconf->get_path();
print "$path\n";
my $filename = $smbconf->get_filename();
print "$filename\n";
my @shares = $smbconf->listShares();
print "@shares\n";
##
##
[ghenry@perlbox lib]$ perl ../scripts/test.pl
/etc/samba/smb.conf
smb.conf
Not a HASH reference at /usr/lib/perl5/site_perl/5.8.6/File/Samba.pm line 181.