BSON::OID - BSON type wrapper for Object IDs
version v1.0.0
use BSON::Types ':all'; my $oid = bson_oid(); my $bytes = $oid->oid; my $hex = $oid->hex;
This module provides a wrapper around a BSON Object ID.
A 12-byte (packed) Object ID (OID) string. If not provided, a new OID will be generated.
Returns the oid attributes as 24-byte hexadecimal value
oid
Returns a number corresponding to the portion of the oid value that represents seconds since the epoch.
Returns a string for this OID, with the OID given as 24 hex digits.
If the BSON_EXTJSON option is true, it will instead be compatible with MongoDB's extended JSON format, which represents it as a document as follows:
BSON_EXTJSON
{"$oid" : "012345678901234567890123"}
The string operator is overloaded so any string operations will actually use the 24-character hex value of the OID. Fallback overloading is enabled.
This module is thread safe.
David Golden <david@mongodb.com>
Stefan G. <minimalist@lavabit.com>
This software is Copyright (c) 2016 by Stefan G. 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.