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  -  CLASS::GOMOR (3)

.ds Aq ’

NAME

Class::Gomor - another class and object builder

CONTENTS

DESCRIPTION

This module is yet another class builder. This one adds parameter checking in <B>newB> 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 <B>B>@AS<B>B>, <B>B>@AA<B>B>, <B>B>@AO<B>B>. 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 <B>Class::Gomor::ArrayB> and <B>Class::Gomor::HashB>, so they will inherite the following methods.

GLOBAL VARIABLES

<B>B>$NoCheck<B>B> Import it in your namespace like this:

use Class::Gomor qw($NoCheck);

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

<B>B>$Debug<B>B> Import it in your namespace like this:

use Class::Gomor qw($Debug);

This variable is used by the <B>cgDebugPrintB> method.

METHODS

<B>cgCheckParamsB> (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 <B>cgGetAttributesB> method (as an array ref). A message is displayed if passed parameters are not valid.
<B>cgGetIsaTreeB> (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.
<B>cgGetAttributesB> This method returns available attributes for caller’s object class. It uses <B>cgGetIsaTreeB> to search recursively in class hierarchy. It then returns an array reference with all possible attributes.
<B>cgBuildAccessorsScalarB> (array ref) Accessor creation method. Takes an array reference containing all scalar attributes to create. Scalar accessors are stored in a global variable names <B>B>@AS<B>B>. So you call this method at the beginning of your class like that:

__PACKAGE__->cgBuildAccessorsScalar(\@AS);

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

__PACKAGE__->cgBuildAccessorsArray(\@AA);

<B>cgCloneB> [ (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.
<B>cgFullCloneB> [ (scalar) ] This method is the same as <B>cgCloneB>, but will clone all attributes recursively, but only if they are subclassed from <B>Class::GomorB>. So, objects created with other modules than <B>Class::Gomor::ArrayB> or <B>Class::Gomor::HashB> 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.

<B>cgDebugPrintB> (scalar, scalar) First argument is a debug level. It is compared with global <B>B>$Debug<B>B>, 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.

SEE ALSO

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

AUTHOR

Patrice <GomoR> Auffret

COPYRIGHT AND LICENSE

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.

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


perl v5.20.3 CLASS::GOMOR (3) 2015-01-13

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