%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/opti/perl/usr/man/man3/
Upload File :
Create Path :
Current File : /home/opti/perl/usr/man/man3/BSON::Types.3pm

.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings.  \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
.    ds -- \(*W-
.    ds PI pi
.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
.    ds L" ""
.    ds R" ""
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds -- \|\(em\|
.    ds PI \(*p
.    ds L" ``
.    ds R" ''
.    ds C`
.    ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
.    if \nF \{
.        de IX
.        tm Index:\\$1\t\\n%\t"\\$2"
..
.        if !\nF==2 \{
.            nr % 0
.            nr F 2
.        \}
.    \}
.\}
.rr rF
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
.    \" fudge factors for nroff and troff
.if n \{\
.    ds #H 0
.    ds #V .8m
.    ds #F .3m
.    ds #[ \f1
.    ds #] \fP
.\}
.if t \{\
.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
.    ds #V .6m
.    ds #F 0
.    ds #[ \&
.    ds #] \&
.\}
.    \" simple accents for nroff and troff
.if n \{\
.    ds ' \&
.    ds ` \&
.    ds ^ \&
.    ds , \&
.    ds ~ ~
.    ds /
.\}
.if t \{\
.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
.    \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
.    \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
.    \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
.    ds : e
.    ds 8 ss
.    ds o a
.    ds d- d\h'-1'\(ga
.    ds D- D\h'-1'\(hy
.    ds th \o'bp'
.    ds Th \o'LP'
.    ds ae ae
.    ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "BSON::Types 3"
.TH BSON::Types 3 "2018-12-07" "perl v5.16.3" "User Contributed Perl Documentation"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
BSON::Types \- Helper functions to wrap BSON type classes
.SH "VERSION"
.IX Header "VERSION"
version v1.10.2
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 1
\&    use BSON::Types \*(Aq:all\*(Aq;
\&
\&    $int32   = bson_int32(42);
\&    $double  = bson_double(3.14159);
\&    $decimal = bson_decimal("24.01");
\&    $time    = bson_time(); # now
\&    ...
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
This module provides helper functions for \s-1BSON\s0 type wrappers.  Type
wrappers use objects corresponding to \s-1BSON\s0 types to represent data that
would have ambiguous type or don't have a native Perl representation
.PP
For example, because Perl scalars can represent strings, integers or
floating point numbers, the serialization rules depend on various
heuristics.  By wrapping a Perl scalar with a class, such as
BSON::Int32, users can specify exactly how a scalar should serialize to
\&\s-1BSON.\s0
.SH "FUNCTIONS"
.IX Header "FUNCTIONS"
.SS "bson_bytes"
.IX Subsection "bson_bytes"
.Vb 2
\&    $bytes = bson_bytes( $byte_string );
\&    $bytes = bson_bytes( $byte_string, $subtype );
.Ve
.PP
This function returns a BSON::Bytes object wrapping the provided string.
A numeric subtype may be provided as a second argument, but this is not
recommended for new applications.
.SS "bson_code"
.IX Subsection "bson_code"
.Vb 2
\&    $code = bson_code( $javascript );
\&    $code = bson_code( $javascript, $hashref );
.Ve
.PP
This function returns a BSON::Code object wrapping the provided Javascript
code.  An optional hashref representing variables in scope for the function
may be given as well.
.SS "bson_dbref"
.IX Subsection "bson_dbref"
.Vb 1
\&    $dbref = bson_dbref( $object_id, $collection_name );
.Ve
.PP
This function returns a BSON::DBRef object wrapping the provided Object \s-1ID\s0
and collection name.
.SS "bson_decimal128"
.IX Subsection "bson_decimal128"
.Vb 2
\&    $decimal = bson_decimal128( "0.12" );
\&    $decimal = bson_decimal128( "1.23456789101112131415116E\-412" );
.Ve
.PP
This function returns a BSON::Decimal128 object wrapping the provided
decimal \fBstring\fR.  Unlike floating point values, this preserves exact
decimal precision.
.SS "bson_doc"
.IX Subsection "bson_doc"
.Vb 1
\&    $doc = bson_doc( first => "hello, second => "world" );
.Ve
.PP
This function returns a BSON::Doc object, which preserves the order
of the provided key-value pairs.
.SS "bson_double"
.IX Subsection "bson_double"
.Vb 1
\&    $double = bson_double( 1.0 );
.Ve
.PP
This function returns a BSON::Double object wrapping a native
double value.  This ensures it serializes to \s-1BSON\s0 as a double rather
than a string or integer given Perl's lax typing for scalars.
.SS "bson_int32"
.IX Subsection "bson_int32"
.Vb 1
\&    $int32 = bson_int32( 42 );
.Ve
.PP
This function returns a BSON::Int32 object wrapping a native
integer value.  This ensures it serializes to \s-1BSON\s0 as an Int32 rather
than a string or double given Perl's lax typing for scalars.
.SS "bson_int64"
.IX Subsection "bson_int64"
.Vb 1
\&    $int64 = bson_int64( 0 ); # 64\-bit zero
.Ve
.PP
This function returns a BSON::Int64 object, wrapping a native
integer value.  This ensures it serializes to \s-1BSON\s0 as an Int64 rather
than a string or double given Perl's lax typing for scalars.
.SS "bson_maxkey"
.IX Subsection "bson_maxkey"
.Vb 1
\&    $maxkey = bson_maxkey();
.Ve
.PP
This function returns a singleton representing the \*(L"maximum key\*(R"
\&\s-1BSON\s0 type.
.SS "bson_minkey"
.IX Subsection "bson_minkey"
.Vb 1
\&    $minkey = bson_minkey();
.Ve
.PP
This function returns a singleton representing the \*(L"minimum key\*(R"
\&\s-1BSON\s0 type.
.SS "bson_oid"
.IX Subsection "bson_oid"
.Vb 3
\&    $oid = bson_oid();         # generate a new one
\&    $oid = bson_oid( $bytes ); # from 12\-byte packed OID
\&    $oid = bson_oid( $hex   ); # from 24 hex characters
.Ve
.PP
This function returns a \s-1BSON::OID\s0 object wrapping a 12\-byte MongoDB Object
\&\s-1ID. \s0 With no arguments, a new, unique Object \s-1ID\s0 is generated instead.  If
24 hexadecimal characters are given, they will be packed into a 12\-byte
Object \s-1ID.\s0
.SS "bson_raw"
.IX Subsection "bson_raw"
.Vb 1
\&    $raw = bson_raw( $bson_encoded );
.Ve
.PP
This function returns a BSON::Raw object wrapping an already BSON-encoded
document.
.SS "bson_regex"
.IX Subsection "bson_regex"
.Vb 2
\&    $regex = bson_regex( $pattern );
\&    $regex = bson_regex( $pattern, $flags );
.Ve
.PP
This function returns a BSON::Regex object wrapping a \s-1PCRE\s0 pattern and
optional flags.
.SS "bson_string"
.IX Subsection "bson_string"
.Vb 1
\&    $string = bson_string( "08544" );
.Ve
.PP
This function returns a BSON::String object, wrapping a native
string value.  This ensures it serializes to \s-1BSON\s0 as a \s-1UTF\-8\s0 string rather
than an integer or double given Perl's lax typing for scalars.
.SS "bson_time"
.IX Subsection "bson_time"
.Vb 1
\&    $time = bson_time( $seconds_from_epoch );
.Ve
.PP
This function returns a BSON::Time object representing a \s-1UTC\s0 date and
time to millisecond precision.  The argument must be given as a number of
seconds relative to the Unix epoch (positive or negative).  The number may
be a floating point value for fractional seconds.  If no argument is
provided, the current time from Time::HiRes is used.
.SS "bson_timestamp"
.IX Subsection "bson_timestamp"
.Vb 1
\&    $timestamp = bson_timestamp( $seconds_from_epoch, $increment );
.Ve
.PP
This function returns a BSON::Timestamp object.  It is not recommended
for general use.
.SS "bson_bool (\s-1DISCOURAGED\s0)"
.IX Subsection "bson_bool (DISCOURAGED)"
.Vb 2
\&    # for consistency with other helpers
\&    $bool = bson_bool( $expression );
\&
\&    # preferred for efficiency
\&    use boolean;
\&    $bool = boolean( $expression );
.Ve
.PP
This function returns a boolean object (true or false) based on the
provided expression (or false if no expression is provided).  It is
provided for consistency so that all \s-1BSON\s0 types have a corresponding helper
function.
.PP
For efficiency, use \f(CW\*(C`boolean::boolean()\*(C'\fR directly, instead.
.SH "AUTHORS"
.IX Header "AUTHORS"
.IP "\(bu" 4
David Golden <david@mongodb.com>
.IP "\(bu" 4
Stefan G. <minimalist@lavabit.com>
.SH "COPYRIGHT AND LICENSE"
.IX Header "COPYRIGHT AND LICENSE"
This software is Copyright (c) 2018 by Stefan G. and MongoDB, Inc.
.PP
This is free software, licensed under:
.PP
.Vb 1
\&  The Apache License, Version 2.0, January 2004
.Ve

Zerion Mini Shell 1.0