in reply to Tie and Filesys::SmbClient

It works for me;) I made some changes just to try out the object API and found a bug (I think) in version 3.1 of Filesys::SmbClient. The docs say that the return from read is undef at EOF but it is actually an empty string.

Personally I'd use a hash for the arguments to emphasize that they are key value pairs. Makes no difference to perl but it will be easier to maintain and you get a warning if the numbers aren't even. The use POSIX isn't required by your example.

The object oriented approach (which tie uses behind the scenes)

use strict; use warnings; use Filesys::SmbClient; my %args = ( username => 'account', password => 'secret', workgroup => 'domain', debug => 0 ); my $smb = new Filesys::SmbClient(%args); my $filename = 'smb://server/share/directory/file.name'; my $remote = $smb->open($filename) or die "Can't open $filename: $!\n" +; open my $local, '>', 'file.name' or die "Can't open file.name: $!\n"; while ( defined( my $buffer = $smb->read($remote) ) ) { last if $buffer eq ''; print {$local} $buffer; } $smb->close($fd);