Giter Club home page Giter Club logo

perlbsonstream's Introduction

NAME

BSON::Stream - Read BSON data from stream (file).

SYNOPSIS use BSON::Stream;

my $file = shift @ARGV or die("Pleas specify a file to read!");

open(my $INF,$file) or die("Can not open file '$file':$!");

my $bsonstream = BSON::Stream->new($INF);

while (my $res = $bsonstream->get) {

  printf("%s own %s apples\n",$res->{'name'}, $res->{'apples'});

}

close($INF);
        

DESCRIPTION

BSON::Stream allows you to read one and one BSON record from a file and get it back as a Perl structure.

Reading from STDIN

use BSON::Stream;

my $bsonstream = BSON::Stream->new(*STDIN);

while (my $res = $bsonstream->get) {

  printf("%s own %s apples\n",$res->{'name'}, $res->{'apples'});

}

BSON files can quickly become very large. One common way of dealing with this is to compress them using gzip, then use zcat to uncompressed and pipe the raw BSON data into a program on the fly.

zcat eg/testdata/users.bson.gz | perl eg/synopsis-STDIN.pl

EXAMPLES

Please see the eg/ directory for further examples.

SEE ALSO

BSON

AUTHOR

Runar Buvik
CPAN ID: RUNARB
[email protected]
http://www.runarb.com

Git

https://github.com/runarbu/PerlBSONStream

COPYRIGHT

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.

perlbsonstream's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.