NAME

Filesys::SmbClient - Perl extension for access Samba filesystem with libsmclient.so

SYNOPSIS

use POSIX;
use Filesys::SmbClient;

my $smb = new Filesys::SmbClient("alian",10);

# Read a file
my $fd = $smb->open("smb://jupiter/doc/toto",O_RDONLY, 0666);
while (defined(my $l= $smb->read($fd,50))) {print $l; }
$smb->close(fd);

# Write a file
my $fd = $smb->open("smb://jupiter/doc/test",O_CREAT, 0666);
$smb->write($fd,"A test of write call") || print $!,"\n";
$smb->close(fd);

# Rename a file
$smb->rename("smb://jupiter/doc/toto","smb://jupiter/doc/tata"),"\n";

# Create a directory (not yet implemented in libsmbclient.so ;-)
$smb->mkdir("smb://jupiter/doc/toto",10);

# Delete a file
$smb->unlink("smb://jupiter/doc/test");

# Stat a file
my @tab = $smb->stat("smb://jupiter/doc/tata");
for (10..12) {$tab[$_] = localtime($tab[$_]);}
print join("\n",@tab);

DESCRIPTION

Provide interface to access routine defined in libsmbclient.so. On 2000/12/28, this library is only available with CVS source of Samba (target head), See on samba.org web site, section developpement. This module is a beta version !

When a path is used, his scheme is :

smb://server/share/rep/doc

VERSION

$Revision: 0.1.1.1 $

FONCTIONS

new($wgroup,$debug)

Init some things

$wgroup : Current workgroup
$debug : level of debug

Return 0 on succes, errno else.

unlink($fname)

Delete file $fname

Return 0 on succes, errno else.

mkdir($fname,$mode)

Create directory $fname with permissions set to $mode

stat($fname)

Stat a file to get info via file $fname. Return a array with info on success, else errno is return and $! is set. Tab is made with:

  • device

  • inode

  • protection

  • number of hard links

  • user ID of owner

  • group ID of owner

  • device type (if inode device)

  • total size, in bytes

  • blocksize for filesystem I/O

  • number of blocks allocated

  • time of last access

  • time of last modification

  • time of last change

rename($oname,$nname)

Rename $oname in $nname. Return 0 on success, else -1 is return and errno and $! is set.

open($fname, $flags, $mode)

Open file $fname with flags $flags and mode $mode. Return file descriptor on success, else -1 is return and errno and $! is set.

read($fd,$count)

Read $count bytes of data on file descriptor $fd. Return buffer read on success, undef at end of file, -1 is return on error and $! is set.

write($fd,$buf)

Write $buf on file descriptor $fd. Return number of bytes wrote, else -1 is return and errno and $! is set.

close($fd)

Close file descriptior $fd. Return 0 on success, else -1 is return and errno and $! is set.

AUTHOR

Alain BARBET, alian@alianwebserver.com