=head1 NAME

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

=head1 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);
	
=head1 DESCRIPTION

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

=head2 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

=head1 EXAMPLES

Please see the C<eg/> directory for further examples.

=head1 SEE ALSO

F<BSON>

=head1 AUTHOR

    Runar Buvik
    CPAN ID: RUNARB
    runarb@gmail.com
    http://www.runarb.com

=head1 Git

https://github.com/runarbu/PerlBSONStream

=head1 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.


