Provided by: libclass-meta-perl_0.66-3_all bug

NAME

       Class::Meta::Class - Class::Meta class introspection

SYNOPSIS

         # Assuming MyApp::Thingy was generated by Class::Meta.
         my $class = MyApp::Thingy->my_class;
         my $thingy = MyApp::Thingy->new;

         print "Examining object of class ", $class->package, $/;

         print "\nConstructors:\n";
         for my $ctor ($class->constructors) {
             print "  o ", $ctor->name, $/;
         }

         print "\nAttributes:\n";
         for my $attr ($class->attributes) {
             print "  o ", $attr->name, " => ", $attr->get($thingy) $/;
         }

         print "\nMethods:\n";
         for my $meth ($class->methods) {
             print "  o ", $meth->name, $/;
         }

DESCRIPTION

       Object of this class describe classes created by Class::Meta. They contain everything you
       need to know about a class to be able to put objects of that class to good use. In
       addition to retrieving meta data about the class itself, you can retrieve objects that
       describe the constructors, attributes, and methods of the class. See
       "Class::Meta|Class::Meta" for a fuller description of the utility of the Class::Meta suite
       of modules.

       Class::Meta::Class objects are created by Class::Meta; they are never instantiated
       directly in client code. To access the class object for a Class::Meta-generated class,
       simply call its "my_class()" method.

       At this point, those attributes tend to be database-specific. Once other types of data
       stores are added (XML, LDAP, etc.), other attributes may be added to allow their schemas
       to be built, as well.

INTERFACE

   Constructors
       new

       A protected method for constructing a Class::Meta::Class object. Do not call this method
       directly; Call the "new()" constructor on a Class::Meta object, instead. A
       Class::Meta::Class object will be constructed by default, and can always be retrieved via
       the "my_class()" method of the class for which it was constructed.

   Instance Methods
       package

         my $pkg = $class->package;

       Returns the name of the package that the Class::Meta::Class object describes.

       key

         my $key = $class->key;

       Returns the key name that uniquely identifies the class across the application. The key
       name may simply be the same as the package name.

       name

         my $name = $class->name;

       Returns the name of the the class. This should generally be a descriptive name, rather
       than a package name.

       desc

         my $desc = $class->desc;

       Returns a description of the class.

       abstract

         my $abstract = $class->abstract;

       Returns true if the class is an abstract class, and false if it is not.

       default_type

         my $default_type = $class->default_type;

       The data type used for attributes of the class that were added with no explicit types.

       trusted

         my @trusted = $class->trusted;
         my $trusted = $class->trusted;

       In an array context, returns a list of class names that this class trusts.  Returns the
       same list in an array reference in a scalar context.

       is_a

         if ($class->is_a('MyApp::Base')) {
             print "All your base are belong to us\n";
         }

       This method returns true if the object or package name passed as an argument is an
       instance of the class described by the Class::Meta::Class object or one of its subclasses.
       Functionally equivalent to "$class->package->isa($pkg)", but more efficient.

       constructors

         my @constructors = $class->constructors;
         my $ctor = $class->constructors($ctor_name);
         @constructors = $class->constructors(@ctor_names);

       Provides access to the Class::Meta::Constructor objects that describe the constructors for
       the class. When called with no arguments, it returns all of the constructor objects. When
       called with a single argument, it returns the constructor object for the constructor with
       the specified name. When called with a list of arguments, returns all of the constructor
       objects with the specified names.

       attributes

         my @attributes = $class->attributes;
         my $attr = $class->attributes($attr_name);
         @attributes = $class->attributes(@attr_names);

       Provides access to the Class::Meta::Attribute objects that describe the attributes for the
       class. When called with no arguments, it returns all of the attribute objects. When called
       with a single argument, it returns the attribute object for the attribute with the
       specified name. When called with a list of arguments, returns all of the attribute objects
       with the specified names.

       methods

         my @methods = $class->methods;
         my $meth = $class->methods($meth_name);
         @methods = $class->methods(@meth_names);

       Provides access to the Class::Meta::Method objects that describe the methods for the
       class. When called with no arguments, it returns all of the method objects. When called
       with a single argument, it returns the method object for the method with the specified
       name. When called with a list of arguments, returns all of the method objects with the
       specified names.

       parents

         my @parents = $class->parents;

       Returns a list of Class::Meta::Class objects representing all of the Class::Meta-built
       parent classes of a class.

       handle_error

         $class->handle_error($error)

       Handles Class::Meta-related errors using either the error handler specified when the
       Class::Meta::Class object was created or the default error handler at the time the
       Class::Meta::Class object was created.

       build

         $class->build($classes);

       This is a protected method, designed to be called only by the Class::Meta class or a
       subclass of Class::Meta. It copies the attribute, constructor, and method objects from all
       of the parent classes of the class object so that they will be readily available from the
       "attributes()", "constructors()", and "methods()" methods. Its sole argument is a
       reference to the hash of all Class::Meta::Class objects (keyed off their package names)
       stored by Class::Meta.

       Although you should never call this method directly, subclasses of Class::Meta::Class may
       need to override its behavior.

SUPPORT

       This module is stored in an open GitHub repository <http://github.com/theory/class-meta/>.
       Feel free to fork and contribute!

       Please file bug reports via GitHub Issues <http://github.com/theory/class-meta/issues/> or
       by sending mail to bug-Class-Meta@rt.cpan.org <mailto:bug-Class-Meta@rt.cpan.org>.

AUTHOR

       David E. Wheeler <david@justatheory.com>

SEE ALSO

       Other classes of interest within the Class::Meta distribution include:

       Class::Meta
       Class::Meta::Constructor
       Class::Meta::Attribute
       Class::Meta::Method

COPYRIGHT AND LICENSE

       Copyright (c) 2002-2011, David E. Wheeler. Some Rights Reserved.

       This module is free software; you can redistribute it and/or modify it under the same
       terms as Perl itself.