MongoDB::GridFS::File3pm
A mongo gridfs file (deprecated)
Usage
use MongoDB::GridFS::File;$outfile = IO::File->new("outfile", "w");$file = $grid->find_one;$file->print($outfile);
Version
version v1.4.5
Usage
Error handling
Unless otherwise explicitly documented, all methods throw exceptions if an error occurs. The error types are documented in MongoDB::Error.
To catch and handle errors, the Try::Tiny and Safe::Isa modules are recommended:
use Try::Tiny;use Safe::Isa; # provides $_isa$bytes = try {$file->slurp;}catch {if ( $_->$_isa("MongoDB::TimeoutError" ) {...}else {...}};
To retry failures automatically, consider using Try::Tiny::Retry.
Attributes
info
A hash reference of metadata saved with this file.
Methods
$written = $file->print($fh);$written = $file->print($fh, $length);$written = $file->print($fh, $length, $offset)
Writes the number of bytes specified from the offset specified to the given file handle. If no $length or $offset are given, the entire file is written to $fh. Returns the number of bytes written.
slurp
$all = $file->slurp$bytes = $file->slurp($length);$bytes = $file->slurp($length, $offset);
Return the number of bytes specified from the offset specified. If no $length or $offset are given, the entire file is returned.
Deprecation
Note: This class has been deprecated in favor of MongoDB::GridFSBucket and its related upload and download classes. This class will be removed in a future release and you are encouraged to migrate your applications to MongoDB::GridFSBucket.
Copyright and license
This software is Copyright (c) 2016 by MongoDB, Inc.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004
Releases
3 releases since Debian 7 (Wheezy); the text changed 2 times.