NAME
BSON::String - String data for BSON
SYNOPSIS
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 } );
DESCRIPTION
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 ""
.
METHODS
new
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
...;
}
value
Returns the value of the string.
OVERLOAD
Only the ""
operator is overloaded. You won't be able to perform string comparison on a BSON::String instance.
SEE ALSO
AUTHOR
minimalist, <minimalist at lavabit.com>
BUGS
Bug reports and patches are welcome. Reports which include a failing Test::More style test are helpful and will receive priority.
LICENSE AND COPYRIGHT
Copyright 2011 minimalist.
This program is free software; you can redistribute it and/or modify it under the terms as perl itself.