MogileFS::Client::CallbackFile
my $mogfs = MogileFS::Client::Callback->new( ... ) open(my $read_fh, "<", "...") or die ... my $eventual_length = -s $read_fh; my $f = $mogfs->store_file_from_fh($key, $class, $read_fh, $eventual_length, \%opts); $f->($eventual_length, 0); # upload entire file $f->($eventual_length, 1); # indicate EOF
This package inherits from MogileFS::Client::Async and provides an additional blocking API in which the data you wish to upload is read from a file when commanded by a callback function. This allows other processing to take place on data as you read it from disc or elsewhere.
The trackers, and storage backends, are tried repeatedly until the file is successfully stored, or an error is thrown.
The $key parameter may be a closure. In this case, it is called every time before create_open is called, allowing a different key to be used if an upload fails, allowing for additional paranoia.
$key
create_open
To install MogileFS::Client::Async, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MogileFS::Client::Async
CPAN shell
perl -MCPAN -e shell install MogileFS::Client::Async
For more information on module installation, please visit the detailed CPAN module installation guide.