GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  BSON::OBJECTID (3)

.ds Aq ’

NAME

BSON::ObjectId - ObjectId data element for BSON

CONTENTS

SYNOPSIS



    use BSON;

    my $oid  = BSON::ObjectId->new;
    my $oid2 = BSON::ObjectId->new($string);
    my $oid3 = BSON::ObjectId->new($binary_string);



DESCRIPTION

This module is needed for BSON and it manages BSON’s ObjectId element.

METHODS

    new

Main constructor which takes one optional parameter, a string with ObjectId. ObjectId can be either a 24 character hexadecimal value or a 12 character binary value.



    my $oid  = BSON::ObjectId->new("4e24d6249ccf967313000000");
    my $oid2 = BSON::ObjectId->new("\x4e\x24\xd6\x24\x9c\xcf\x96\x73\x13\0\0\0");



If no ObjectId string is specified, a new one will be generated based on the machine ID, process ID and the current time.

    value

Returns or sets the ObjectId value.



    $oid->value("4e262c24422ad15e6a000000");
    print $oid->value; # Will print it in binary



    is_legal

Returns true if the 24 character string passed matches an ObjectId.



    if ( BSON::ObjectId->is_legal($id) ) {
        ...
    }



OVERLOAD

The string operator is overloaded so any string operations will actually use the 24-character value of the ObjectId.

THREADS

This module is thread safe.

SEE ALSO

BSON

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.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 BSON::OBJECTID (3) 2011-07-22

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.