BSON::String - String data for BSON
version 0.16
use BSON 'encode'; my $str1 = BSON::String->new('Jack Reacher'); my $str2 = BSON::String->new('55'); my $str3 = BSON::String->new('-1234.7654'); my $bson = encode( { a => $str1, b => $str2, c => $str3 } );
Since Perl does not distinguish between numbers and strings, this module is provides an explicit string type for BSON's string element. It's very simple and does not implement any operator overloading other than "".
""
Main constructor which takes a single parameter - the string.
my $string = BSON::String->new('Hello, there!'); print "$string\n"; # Prints 'Hello, there!' if ( "$string" gt "abcde" ) { # This will work ...; }
Returns the value of the string.
Only the "" operator is overloaded. You won't be able to perform string comparison on a BSON::String instance.
BSON
minimalist <minimalist@lavabit.com>
David Golden <david@mongodb.com>
This software is Copyright (c) 2015 by minimalist and MongoDB, Inc..
This is free software, licensed under:
The Apache License, Version 2.0, January 2004
To install BSON, copy and paste the appropriate command in to your terminal.
cpanm
cpanm BSON
CPAN shell
perl -MCPAN -e shell install BSON
For more information on module installation, please visit the detailed CPAN module installation guide.