# man > BSON::Int32

---
type: CommandReference
command: BSON::Int32
mode: perldoc
section: 3pm
source: perldoc
---

## Quick Reference

- `use BSON::Types ':all'; bson_int32($value)` — create a BSON Int32 wrapper
- `$obj->value` — get/set the integer value (default 0)
- `0 + $obj` — numification returns the integer value
- `$obj->TO_JSON` — returns integer or extended JSON document

## Name

BSON::Int32 — BSON type wrapper for 32-bit integers

## Synopsis

perl
use BSON::Types ':all';
bson_int32( $number );
## Options

- `value` — numeric scalar, coerced to integer, default 0.
- `TO_JSON` — if `BSON_EXTJSON` is true and `BSON_EXTJSON_RELAXED` false, returns a hashref like `{"$numberInt":"42"}`; otherwise returns the integer.
- Overloading: `0+` returns `value`; full minimal overload set provided, with fallback enabled.

## Examples

perl
use BSON::Types ':all';

my $int = bson_int32(42);
print 0 + $int;            # 42
print $int->TO_JSON;       # 42 (or {"$numberInt":"42"} depending on env)
## See Also

- [BSON::Types](http://localhost/phpMan.php/perldoc/BSON%3A%3ATypes/markdown)
- [BSON](http://localhost/phpMan.php/perldoc/BSON/markdown)