X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FClass%2FMOP%2FImmutable.pm;h=e1f279aa95a911a4856cc46f8899d1999b450fa6;hb=e056bd4245c57e24563a47d918872731e77a5e73;hp=c119db0b4b16c45731c5ab1fb56645dc6b0ea8e6;hpb=c6e75cb33bd9fd33d777325cdc3de6d5de614263;p=gitmo%2FClass-MOP.git diff --git a/lib/Class/MOP/Immutable.pm b/lib/Class/MOP/Immutable.pm index c119db0..e1f279a 100644 --- a/lib/Class/MOP/Immutable.pm +++ b/lib/Class/MOP/Immutable.pm @@ -97,11 +97,18 @@ sub _inline_constructor { return unless $self->options->{inline_constructor}; - return - unless $self->options->{replace_constructor} - or !$self->metaclass->has_method( - $self->options->{constructor_name} - ); + unless ($self->options->{replace_constructor} + or !$self->metaclass->has_method( + $self->options->{constructor_name} + )) { + my $class = $self->metaclass->name; + warn "Not inlining a constructor for $class since it defines" + . " its own constructor.\n" + . "If you are certain you don't need to inline your" + . " constructor, specify inline_constructor => 0 in your" + . " call to $class->meta->make_immutable\n"; + return; + } my $constructor_class = $self->options->{constructor_class};