1Rose::DB::Object::MakeMUestehrodCso:n:tBriigbNuutme(d3R)Poesrel::DDoBc:u:mOebnjteactti:o:nMakeMethods::BigNum(3)
2
3
4

NAME

6       Rose::DB::Object::MakeMethods::BigNum - Create object methods for
7       arbitrary-precision numeric attributes for Rose::DB::Object-derived
8       objects.
9

SYNOPSIS

11         package MyDBObject;
12
13         our @ISA = qw(Rose::DB::Object);
14
15         use Rose::DB::Object::MakeMethods::BigNum
16         (
17           bigint =>
18           [
19             count =>
20             {
21               with_init => 1,
22               min       => 0,
23             },
24
25             # Important: specify very large integer values as strings
26             tally => { default => '9223372036854775800' },
27           ],
28         );
29
30         sub init_count { 12345 }
31         ...
32
33         $obj = MyDBObject->new(...);
34
35         print $obj->count; # 12345
36         print $obj->tally; # 9223372036854775800
37

DESCRIPTION

39       Rose::DB::Object::MakeMethods::BigNum is a method maker that inherits
40       from Rose::Object::MakeMethods.  See the Rose::Object::MakeMethods
41       documentation to learn about the interface.  The method types provided
42       by this module are described below.
43
44       All method types defined by this module are designed to work with
45       objects that are subclasses of (or otherwise conform to the interface
46       of) Rose::DB::Object.  See the Rose::DB::Object documentation for more
47       details.
48

METHODS TYPES

50       bigint
51           Create get/set methods for big integer attributes.  Values are
52           stored internally and returned as Math::BigInt objects.  When
53           specifying very large integer values, use strings to be safe.  (See
54           an example in the synopsis above.)
55
56           Options
57               check_in ARRAYREF
58                   A reference to an array of valid values.  When setting the
59                   attribute, if the new value is not equal to one of the
60                   valid values, a fatal error will occur.
61
62               default VALUE
63                   Determines the default value of the attribute.
64
65               hash_key NAME
66                   The key inside the hash-based object to use for the storage
67                   of this attribute.  Defaults to the name of the method.
68
69               init_method NAME
70                   The name of the method to call when initializing the value
71                   of an undefined attribute.  Defaults to the method name
72                   with the prefix "init_" added.  This option implies
73                   "with_init".
74
75               interface NAME
76                   Choose the interface.  The default is "get_set".
77
78               max INT
79                   Get or set the maximum value this attribute is allowed to
80                   have.
81
82               min INT
83                   Get or set the minimum value this attribute is allowed to
84                   have.
85
86               with_init BOOL
87                   Modifies the behavior of the "get_set" and "get"
88                   interfaces.  If the attribute is undefined, the method
89                   specified by the "init_method" option is called and the
90                   attribute is set to the return value of that method.
91
92           Interfaces
93               Interfaces
94                   get_set
95                       Creates a get/set method for a big integer object
96                       attribute.  When called with an argument, the value of
97                       the attribute is set.  The current value of the
98                       attribute is returned.
99
100                   get Creates an accessor method for a big integer object
101                       attribute that returns the current value of the
102                       attribute.
103
104                   set Creates a mutator method for a big integer object
105                       attribute.  When called with an argument, the value of
106                       the attribute is set.  If called with no arguments, a
107                       fatal error will occur.
108
109               Example:
110
111                   package MyDBObject;
112
113                   our @ISA = qw(Rose::DB::Object);
114
115                   use Rose::DB::Object::MakeMethods::BigNum
116                   (
117                     bigint =>
118                     [
119                       count =>
120                       {
121                         with_init => 1,
122                         min       => 0,
123                       },
124
125                       # Important: specify very large integer values as strings
126                       tally => { default => '9223372036854775800' },
127                     ],
128                   );
129
130                   sub init_count { 12345 }
131                   ...
132
133                   $obj = MyDBObject->new(...);
134
135                   print $obj->count; # 12345
136                   print $obj->tally; # 9223372036854775800
137
138                   $obj->count(-1); # Fatal error: minimum value is 0
139

AUTHOR

141       John C. Siracusa (siracusa@gmail.com)
142

LICENSE

144       Copyright (c) 2010 by John C. Siracusa.  All rights reserved.  This
145       program is free software; you can redistribute it and/or modify it
146       under the same terms as Perl itself.
147
148
149
150perl v5.28.0                      2015-R0o3s-e1:8:DB::Object::MakeMethods::BigNum(3)
Impressum