Skip Menu |

This queue is for tickets about the Filesys-SmbClient CPAN distribution.

Report information
The Basics
Id: 54828
Status: resolved
Worked: 14 hours (840 min)
Priority: 0/
Queue: Filesys-SmbClient

People
Owner: PHILIPP [...] cpan.org
Requestors: PHILIPP [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 3.1
Fixed in: 3.99_10



Subject: Needed API changes
There are several issues, and perhaps more than one ticket should be opened, but I thought I'd start with one as at least a placekeeper. (1) The documentation is incomplete and simple inaccurate in several places. (2) The paradigm of return values is not consistent with Perl: it's a simple 1:1 mapping of the C API. This is not appropriate. In UNIX C, returning 0 means success. In Perl, returning 0 or undef means failure. Not respecting the latter is going to confuse a lot of Perl veterans. An example of this is: $smb->close($fh) || die "..." won't work, because close() returns < 0 to indicate an error. It should return undef or 0 to indicate an error. (3) Having to reference two separate objects per operation (i.e. "$smb->write($fh, $buf)") is clunky. Why not have open() return an object that includes the reference to the $smb and the file handle? (4) Since Perl 5.6, IO::Handle is how most modules elect to do I/O. $smb->open() should return an IO::Handle-derived object. (5) A "tell()" method is needed, since different O/S's have different newline termination, which might cause offsets to be different from one O/S to another for ASCII files. (6) A "truncate()" method would also be useful to shrink the file after rewriting it in place. (7) Improper type conversion on one of the values returned by the stat() method (I believe it's the "device type") being unpacked as a float or a double.
On Sat Feb 20 20:25:28 2010, PHILIPP wrote: Show quoted text
> (7) Improper type conversion on one of the values returned by the stat() > method (I believe it's the "device type") being unpacked as a float or a > double.
Yup. Results from opendir/readdir/stat: . => 20350|0|16877|2|0|0|1.8446744069434e+19|0|512|0|1266781759|1266781714|1266781714 .. => 20350|184|16877|2|0|0|1.8446744069434e+19|0|512|0|1266781759|1266781714|1266781714 backup-2010-02-21-19-54-22.tbz => 20350|1868994|33252|1|0|0|1.8446744069434e+19|66000263|512|128907|1266781751|1266781750|1266781750 Note the 7th column.
Fixed in 3.99_20.