GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  MONGODB::GRIDFS::FILE (3)

.ds Aq ’

NAME

MongoDB::GridFS::File - A Mongo GridFS file

CONTENTS

VERSION

version v1.2.3

SYNOPSIS



    use MongoDB::GridFS::File;

    $outfile = IO::File->new("outfile", "w");
    $file = $grid->find_one;
    $file->print($outfile);



USAGE

    Error handling

Unless otherwise explictly 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

    print



    $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.

AUTHORS

o David Golden <david@mongodb.com>
o Mike Friedman <friedo@friedo.com>
o Kristina Chodorow <k.chodorow@gmail.com>
o Florian Ragwitz <rafl@debian.org>

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



Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 MONGODB::GRIDFS::FILE (3) 2016-03-08

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.