Rose::DB::Object::MakeMethods::BigNum(3pm) | User Contributed Perl Documentation | Rose::DB::Object::MakeMethods::BigNum(3pm) |
Rose::DB::Object::MakeMethods::BigNum - Create object methods for arbitrary-precision numeric attributes for Rose::DB::Object-derived objects.
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
Rose::DB::Object::MakeMethods::BigNum is a method maker that inherits from Rose::Object::MakeMethods. See the Rose::Object::MakeMethods documentation to learn about the interface. The method types provided by this module are described below.
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.
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
John C. Siracusa (siracusa@gmail.com)
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.
2022-08-26 | perl v5.28.1 |