NAME
Class::Meta::Constructor - Class::Meta class constructor introspection
SYNOPSIS
# Assuming MyApp::Thingy was generated by Class::Meta.
my $class = MyApp::Thingy->class;
print "\nConstructors:\n";
for my $ctor ($class->constructors) {
print " o ", $ctor->name, $/;
my $thingy = $ctor->call;
}
DESCRIPTION
This class provides an interface to the Class::Meta
objects that describe class constructors. It supports a simple description of the constructor, a label, and the constructor visibility (private, protected, or public).
Class::Meta::Constructor objects are created by Class::Meta; they are never instantiated directly in client code. To access the constructor objects for a Class::Meta-generated class, simply call its class
method to retrieve its Class::Meta::Class object, and then call the constructors()
method on the Class::Meta::Class object.
INTERFACE
Instance Methods
name
my $name = $ctor->name;
Returns the constructor name.
package
my $package = $ctor->package;
Returns the package name of the class that constructor is associated with.
desc
my $desc = $ctor->desc;
Returns the description of the constructor.
label
my $desc = $ctor->label;
Returns label for the constructor.
view
my $view = $ctor->view;
Returns the view of the constructor, reflecting its visibility. The possible values are defined by the following constants:
call
my $obj = $ctor->call(@params);
Executes the constructor for the class, passing the parameters to it. Note that it uses a goto
to execute the constructor, so the call to call()
itself will not appear in a call stack trace.
DISTRIBUTION INFORMATION
This file was packaged with the Class-Meta-0.13 distribution.
BUGS
Please report all bugs via the CPAN Request Tracker at http://rt.cpan.org/NoAuth/Bugs.html?Dist=Class-Meta.
AUTHOR
David Wheeler <david@kineticode.com>
SEE ALSO
Other classes of interest within the Class::Meta distribution include:
COPYRIGHT AND LICENSE
Copyright (c) 2002-2004, David Wheeler. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.