Quick Navigator

Search Site

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

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages
Mango::BSON::Number(3) User Contributed Perl Documentation Mango::BSON::Number(3)

Mango::BSON::Number - Numerical types

  use Mango::BSON;
  use Mango::BSON::Number;
  my $number = Mango::BSON::Number->new(666, Mango::BSON::INT64);
  say $number;

Mango::BSON::Number is a container for numerical values with a strict type.

Mango::BSON::Number inherits all methods from Mojo::Base and implements the following new ones.

  my $number = Mango::BSON::Number->new(3.14, Mango::BSON::DOUBLE);
Construct a new Mango::BSON::Number object. Croak if the value is incompatible with the given type. The 3 supported types are "DOUBLE", "INT32" and "INT64".

  my $num = $obj->TO_JSON;
Return the numerical value.

  my $str = $num->to_string;
Return the value as a string.

  my $flags = Mango::BSON::Number::isa_number(25);
Determine if the given variable is a number by looking at the internal flags of the perl scalar object.
Return "undef" if the value is not a number, or a non-null value otherwise. This value contains flags which can be used for finer analysis of the scalar.

  my $mongo_type = Mango::BSON::Number::guess_type(25);
Chose which BSON type to use to encode the given numeric value. Possible types are: "Mango::BSON::DOUBLE", "Mango::BSON::INT32" or "Mango::BSON::INT64".
Return "undef" if the given value is not a number.

Mango::BSON::Time overloads the following operators.

  my $bool = !!$num;

  my $str = "$num";
Alias for "to_string".

Mango, Mojolicious::Guides, <>.
2018-03-17 perl v5.28.1

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

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