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
Class::Gomor(3) User Contributed Perl Documentation Class::Gomor(3)

Class::Gomor - another class and object builder

This module is yet another class builder. This one adds parameter checking in new constructor, that is to check for attributes existence, and definedness.

In order to validate parameters, the module needs to find attributes, and that is the reason for declaring attributes in global variables named @AS, @AA, @AO. They respectively state for Attributes Scalar, Attributes Array and Attributes Other. The last one is used to avoid autocreation of accessors, that is to let you declare your own ones.

Attribute validation is performed by looking at classes hierarchy, by following @ISA tree inheritance.

The loss in speed by validating all attributes is quite negligeable on a decent machine (Pentium IV, 2.4 GHz) with Perl 5.8.x. But if you want to avoid checking, you can do it, see below.

This class is the base class for Class::Gomor::Array and Class::Gomor::Hash, so they will inherite the following methods.

$NoCheck
Import it in your namespace like this:

use Class::Gomor qw($NoCheck);

If you want to disable cgCheckParams to improve speed once your program is frozen, you can use this variable. Set it to 1 to disable parameter checking.

$Debug
Import it in your namespace like this:

use Class::Gomor qw($Debug);

This variable is used by the cgDebugPrint method.

cgCheckParams (hash ref, array ref)
The attribute checking method takes two arguments, the first is user passed attributes (as a hash reference), the second is the list of valid attributes, gathered via cgGetAttributes method (as an array ref). A message is displayed if passed parameters are not valid.
cgGetIsaTree (array ref)
A recursive method. You pass a class in an array reference as an argument, and then the @ISA array is browsed, recursively. The array reference passed as an argument is increased with new classes, pushed into it. It returns nothing, result is stored in the array ref.
cgGetAttributes
This method returns available attributes for caller's object class. It uses cgGetIsaTree to search recursively in class hierarchy. It then returns an array reference with all possible attributes.
cgBuildAccessorsScalar (array ref)
Accessor creation method. Takes an array reference containing all scalar attributes to create. Scalar accessors are stored in a global variable names @AS. So you call this method at the beginning of your class like that:

__PACKAGE__->cgBuildAccessorsScalar(\@AS);

cgBuildAccessorsArray (array ref)
Accessor creation method. Takes an array reference containing all array attributes to create. Array accessors are stored in a global variable names @AA. So you call this method at the beginning of your class like that:

__PACKAGE__->cgBuildAccessorsArray(\@AA);

cgClone [ (scalar) ]
You can clone one of your objects by calling this method. An optional parameter may be used to create multiple clones. Cloning will occure only on the first level attributes, that is, if you have attributes containing other objects, they will not be cloned.
cgFullClone [ (scalar) ]
This method is the same as cgClone, but will clone all attributes recursively, but only if they are subclassed from Class::Gomor. So, objects created with other modules than Class::Gomor::Array or Class::Gomor::Hash will not be cloned.

Another thing to note, there is no catch for cycling references (when you link two objects with each others). You have been warned.

cgDebugPrint (scalar, scalar)
First argument is a debug level. It is compared with global $Debug, and if it is less than it, the second argument (a message string) is displayed. This method exists because I use it, maybe you will not like it.

Class::Gomor::Array, Class::Gomor::Hash

Patrice <GomoR> Auffret

Copyright (c) 2004-2015, Patrice <GomoR> Auffret

You may distribute this module under the terms of the Artistic license. See LICENSE.Artistic file in the source distribution archive.

2015-01-13 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

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