SMB::OpenFile - A state of opening local or remote file for SMB
use SMB::File; # for server, on Create request my $file = SMB::File->new( name => $create_request->file_name, share_root => $tree->root, is_ipc => $tree->is_ipc, ); my $openfile = $file->supersede; # or: create, open, overwrite etc $openfile->close; $openfile = $file->open_by_disposition(SMB::File::DISPOSITION_OPEN_IF); # for client, on Create response my $file = $create_response->openfile->file;
This class implements an SMB open-file abstraction, mainly for a server.
This class inherits from SMB, so msg, err, mem, dump, auto-created field accessor and other methods are available as well.
Class constructor. Creates an instance of SMB::OpenFile.
FILE is an SMB::File object being open, HANDLE is a unix file descriptor, and ACTION is one of ACTION_OPENED, ACTION_CREATED and so on, see SMB::File.
Performs the opposite operation to the constructor.
Internally this is implemented by calling SMB::File delete_openfile, and the constructor is normally called from SMB::File add_openfile.
For openfile corresponding to the local file (having the actual HANDLE) performs the read operation according to the OPTIONS hash values.
The OPTIONS keys are offset, length and minlen. Option length is mandatory (may be 0), the others are optional and default to 0.
On success, the buffer of length or less bytes being read starting from offset is returned. On error (or if lesser than minlen bytes were read from file HANDLE), undef is returned.
SMB::File, SMB::Server, SMB.
Mikhael Goikhman <migo@cpan.org>
To install SMB, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SMB
CPAN shell
perl -MCPAN -e shell install SMB
For more information on module installation, please visit the detailed CPAN module installation guide.