
EO::Class - introspection class for Perl.

use EO::Class
my $class = EO::Class->new();
$class = EO::Class->new_with_classname( 'Some::Class' );
$class = EO::Class->new_with_object( $foo );
$classname = $class->name;
$methods = $class->methods;
@methods = $class->methods;
if ($class->loaded) {
$path = $class->path
} else {
$class->load();
$path = $class->path;
}
$parent_classes = $class->parents;
$class->add_method(
EO::Method->new()
->name('foo')
->reference( sub {} )
);

EO::Class provides reflection capabilities to Perl and specifically the EO:: tree of modules.

EO::Class inherits from the EO class, and therefore has a constructor and an initializer

EO::Class throws the following exceptions:
If something that EO::Class relies on is not in a complete state to be relied on then EO::Class will throw this exception.
If the parameters passed to methods declared in EO::Class are not complete then EO::Class throws an InvalidParameters exception.
If when trying to load a class the class cannot be found.

In addition to the new() constructor provided by EO, EO::Class provides two additional constructors:
Constructs an EO::Class object with the name parameter set to the the class that OBJECT is an instance of.
Constructs an EO::Class object with the name parameter set to the class that the string CLASS specifies.

gets the classname.
gets a method named STRING from the class. It returns an EO::Method object, or in the case that it doesn't exist, throws an EO::Error::Method::NotFound object.
adds a method to the class. The method is specified by an EO::Method object.
returns a EO::Array of EO::Method objects. In list context it will return a Perl array.
if the class is loaded the path method returns an EO::File object, otherwise an exception is thrown. If EO::File is not installed then a stub object is created that provides only the method as_string(). Essentially you are guaranteed to be able to call as_string() on whatever path() returns. However, it is recommended that you install EO::File after installing EO::Class.
if the class delegates using EO::delegate this returns true.
returns an EO::Array object of EO::Class objects that represents the immediate parents of this class. If parents() is called in list context then it returns a Perl array of the modules parent classes, represented as EO::Class objects.
adds a parent class. This change is system wide throughout the course of this runtime. It will go away when the program terminates.
removes a parent class. This change is system wide throughout the course of this runtime. It will go away when the parent terminates.
returns true if the class is loaded
loads the class into memory

EO::Array, EO::Method, EO::File

James A. Duncan <jduncan@fotango.com>

Copyright 2003 Fotango Ltd. All Rights Reserved