NAME
Class::MOP::Method::Constructor - Method Meta Object for constructors
SYNOPSIS
use Class::MOP::Method::Constructor;
my $constructor = Class::MOP::Method::Constructor->new(
metaclass => $metaclass,
options => {
debug => 1, # this is all for now
},
);
# calling the constructor ...
$constructor->body->execute($metaclass->name, %params);
DESCRIPTION
This is a subclass of Class::MOP::Method
which deals with class constructors. This is used when making a class immutable to generate an optimized constructor.
METHODS
- new (metaclass = $meta, options => \%options)>
- options
-
This returns the options HASH which is passed into
new
. - associated_metaclass
-
This returns the metaclass which is passed into
new
. - attributes
-
This returns the list of attributes which are associated with the metaclass which is passed into
new
. - meta_instance
-
This returns the meta instance which is associated with the metaclass which is passed into
new
. - is_inline
-
This returns a boolean, but since constructors are very rarely not inlined, this always returns true for now.
- can_be_inlined
-
This method always returns true in this class. It exists so that subclasses (like in Moose) can override and do some sort of checking to determine whether or not inlining the constructor is safe.
- initialize_body
-
This creates the code reference for the constructor itself.
Method Generators
- generate_constructor_method
- generate_constructor_method_inline
AUTHORS
Stevan Little <stevan@iinteractive.com>
COPYRIGHT AND LICENSE
Copyright 2006-2008 by Infinity Interactive, Inc.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.