2 package Moose::Meta::Method::Constructor;
8 use List::MoreUtils 'any';
9 use Scalar::Util 'blessed', 'weaken', 'looks_like_number', 'refaddr';
12 use base 'Moose::Meta::Method',
13 'Class::MOP::Method::Constructor';
19 my $meta = $options{metaclass};
21 (ref $options{options} eq 'HASH')
22 || $class->throw_error("You must pass a hash of options", data => $options{options});
24 ($options{package_name} && $options{name})
25 || $class->throw_error("You must supply the package_name and name parameters $Class::MOP::Method::UPGRADE_ERROR_TEXT");
29 'package_name' => $options{package_name},
30 'name' => $options{name},
31 'options' => $options{options},
32 'associated_metaclass' => $meta,
33 'definition_context' => $options{definition_context},
34 '_expected_method_class' => $options{_expected_method_class} || 'Moose::Object',
37 # we don't want this creating
38 # a cycle in the code, if not
40 weaken($self->{'associated_metaclass'});
42 $self->_initialize_body;
49 sub _initialize_body {
51 $self->{'body'} = $self->_generate_constructor_method_inline;
56 # ABSTRACT: Method Meta Object for constructors
64 This class is a subclass of L<Class::MOP::Method::Constructor> that
65 provides additional Moose-specific functionality
67 To understand this class, you should read the the
68 L<Class::MOP::Method::Constructor> documentation as well.
72 C<Moose::Meta::Method::Constructor> is a subclass of
73 L<Moose::Meta::Method> I<and> L<Class::MOP::Method::Constructor>.
77 See L<Moose/BUGS> for details on reporting bugs.