Rose::...:BigNum(3pm)

🌸 NAME 🌸

okay so welcome to Rose::DB::Object::MakeMethods::BigNum (3pm) β€” a user-contributed Perl documentation page, bestie β€” and it exists to create object methods for arbitrary-precision numeric attributes for Rose::DB::Object-derived objects. periodt. πŸ’–

✨ SYNOPSIS ✨

like, imagine your package is doing this:

package MyDBObject;

our @ISA = qw(Rose::DB::Object);

use Rose::DB::Object::MakeMethods::BigNum
(
  bigint =>
  [
    count =>
    {
      with_init => 1,
      min       => 0,
    },

    # Important: specify very large integer values as strings
    tally => { default => '9223372036854775800' },
  ],
);

sub init_count { 12345 }
...

$obj = MyDBObject->new(...);

print $obj->count; # 12345
print $obj->tally; # 9223372036854775800

the output is literally 12345 and 9223372036854775800, no cap. ✨

πŸ’– DESCRIPTION πŸ’–

Rose::DB::Object::MakeMethods::BigNum is a method maker that inherits from Rose::Object::MakeMethods. if you wanna learn about the interface, go read the Rose::Object::MakeMethods documentation β€” it's giving the whole blueprint. the method types this module gives you are described below, bestie.

all method types defined by this module are designed to work with objects that are subclasses of (or otherwise conform to the interface of) Rose::DB::Object. see the Rose::DB::Object documentation for more details. 🫢

πŸŽ€ METHODS TYPES πŸŽ€

🧚 bigint 🧚

create get/set methods for big integer attributes. values are stored internally and returned as Math::BigInt objects. when specifying very large integer values, use strings to be safe. (there's an example in the synopsis above, bestie.) πŸ”₯

🌟 Options 🌟

  • check_in ARRAYREF β€” a reference to an array of valid values. when setting the attribute, if the new value is not equal to one of the valid values, a fatal error will occur. it's giving strict.
  • default VALUE β€” determines the default value of the attribute. standard.
  • hash_key NAME β€” the key inside the hash-based object to use for the storage of this attribute. defaults to the name of the method. iykyk.
  • init_method NAME β€” the name of the method to call when initializing the value of an undefined attribute. defaults to the method name with the prefix "init_" added. this option implies "with_init". noted.
  • interface NAME β€” choose the interface. the default is "get_set". pick your fighter.
  • max INT β€” get or set the maximum value this attribute is allowed to have. ceiling vibes.
  • min INT β€” get or set the minimum value this attribute is allowed to have. floor vibes.
  • with_init BOOL β€” modifies the behavior of the "get_set" and "get" interfaces. if the attribute is undefined, the method specified by the "init_method" option is called and the attribute is set to the return value of that method. auto-fill era.

πŸ’… Interfaces πŸ’…

Interfaces (yes, the original lists it twice β€” we are keeping that energy, no erasure πŸ’€)

  • get_set β€” creates a get/set method for a big integer object attribute. when called with an argument, the value of the attribute is set. the current value of the attribute is returned. classic.
  • get β€” creates an accessor method for a big integer object attribute that returns the current value of the attribute. just read the room.
  • set β€” creates a mutator method for a big integer object attribute. when called with an argument, the value of the attribute is set. if called with no arguments, a fatal error will occur. no silent nonsense.

Example:

package MyDBObject;

our @ISA = qw(Rose::DB::Object);

use Rose::DB::Object::MakeMethods::BigNum
(
  bigint =>
  [
    count =>
    {
      with_init => 1,
      min       => 0,
    },

    # Important: specify very large integer values as strings
    tally => { default => '9223372036854775800' },
  ],
);

sub init_count { 12345 }
...

$obj = MyDBObject->new(...);

print $obj->count; # 12345
print $obj->tally; # 9223372036854775800

$obj->count(-1); # Fatal error: minimum value is 0

πŸ‘‘ AUTHOR πŸ‘‘

John C. Siracusa (siracusa@gmail.com) β€” icon. πŸ’œ

πŸŽ€ LICENSE πŸŽ€

Copyright (c) 2010 by John C. Siracusa. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


okay that's the whole page, bestie. this footer tea is: perl v5.40.1, dated 2025-08-21, and the page name is Rose::...:BigNum(3pm). mwah πŸ’‹

πŸ“¦ where this page comes from