GSP
Quick Navigator

Search Site

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

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  ROSE::DB::OBJECT::MAKEMETHODS::BIGNUM (3)

.ds Aq ’

NAME

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

CONTENTS

SYNOPSIS



  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



DESCRIPTION

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.

METHODS TYPES

<B>bigintB> 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. (See an example in the synopsis above.)
Options
<B>check_in ARRAYREFB> 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.
<B>default VALUEB> Determines the default value of the attribute.
<B>hash_key NAMEB> The key inside the hash-based object to use for the storage of this attribute. Defaults to the name of the method.
<B>init_method NAMEB> 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.
<B>interface NAMEB> Choose the interface. The default is get_set.
<B>max INTB> Get or set the maximum value this attribute is allowed to have.
<B>min INTB> Get or set the minimum value this attribute is allowed to have.
<B>with_init BOOLB> 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.
Interfaces
Interfaces
<B>get_setB> 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.
<B>getB> Creates an accessor method for a big integer object attribute that returns the current value of the attribute.
<B>setB> 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.

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)

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.
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 ROSE::DB::OBJECT::MAKEMETHODS::BIGNUM (3) 2015-03-17

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