NAME

EO::Class - introspection class for Perl.

SYNOPSIS

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 {} )
                  );

DESCRIPTION

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

INHERITANCE

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

EXCEPTIONS

EO::Class throws the following exceptions:

EO::Error::InvalidState

If something that EO::Class relies on is not in a complete state to be relied on then EO::Class will throw this exception.

EO::Error::InvalidParameters

If the parameters passed to methods declared in EO::Class are not complete then EO::Class throws an InvalidParameters exception.

EO::Error::ClassNotFound

If when trying to load a class the class cannot be found.

CONSTRUCTOR

In addition to the new() constructor provided by EO, EO::Class provides two additional constructors:

new_with_object( OBJECT )

Constructs an EO::Class object with the name parameter set to the the class that OBJECT is an instance of.

new_with_classname( CLASS )

Constructs an EO::Class object with the name parameter set to the class that the string CLASS specifies.

METHODS

name()

gets the classname.

get_method( STRING )

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.

add_method( EO::Method )

adds a method to the class. The method is specified by an EO::Method object.

methods()

returns a EO::Array of EO::Method objects. In list context it will return a Perl array.

path()

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.

can_delegate()

if the class delegates using EO::delegate this returns true.

parents()

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.

add_parent( LIST )

adds a parent class. This change is system wide throughout the course of this runtime. It will go away when the program terminates.

del_parent( LIST )

removes a parent class. This change is system wide throughout the course of this runtime. It will go away when the parent terminates.

loaded()

returns true if the class is loaded

load()

loads the class into memory

SEE ALSO

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

AUTHOR

James A. Duncan <jduncan@fotango.com>

COPYRIGHT

Copyright 2003 Fotango Ltd. All Rights Reserved

1 POD Error

The following errors were encountered while parsing the POD:

Around line 373:

You forgot a '=back' before '=head1'