From: Dave Rolsky Date: Mon, 20 Apr 2009 15:20:55 +0000 (-0500) Subject: Move creation of the warning until the end of the method, right before we warn X-Git-Tag: 0.82_01~11^2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b64fd605d176e851085025e08653730e38ff6a7d;p=gitmo%2FClass-MOP.git Move creation of the warning until the end of the method, right before we warn --- diff --git a/lib/Class/MOP/Method/Inlined.pm b/lib/Class/MOP/Method/Inlined.pm index 73de4da..89850b8 100644 --- a/lib/Class/MOP/Method/Inlined.pm +++ b/lib/Class/MOP/Method/Inlined.pm @@ -41,22 +41,6 @@ sub can_be_inlined { # compatible with the definition we are replacing it with my $expected_method = $expected_class->can( $self->name ); - my $warning - = "Not inlining '" - . $self->name - . "' for $class since it is not" - . " inheriting the default ${expected_class}::" - . $self->name . "\n"; - - if ( $self->isa("Class::MOP::Method::Constructor") ) { - - # FIXME kludge, refactor warning generation to a method - $warning - .= "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"; - } - my $actual_method = $class->can( $self->name ) or return 1; @@ -86,6 +70,22 @@ sub can_be_inlined { return 1; } + my $warning + = "Not inlining '" + . $self->name + . "' for $class since it is not" + . " inheriting the default ${expected_class}::" + . $self->name . "\n"; + + if ( $self->isa("Class::MOP::Method::Constructor") ) { + + # FIXME kludge, refactor warning generation to a method + $warning + .= "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"; + } + $warning .= " ('" . $self->name