From: Karen Etheridge Date: Wed, 1 Jun 2011 00:36:27 +0000 (+0000) Subject: return ASAP if the class is already immutable X-Git-Tag: 2.0103~8 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=50e3a18b94cb8ab8dc752c71cd9b2fabb7e75db0;p=gitmo%2FMoose.git return ASAP if the class is already immutable --- diff --git a/lib/Class/MOP/Class.pm b/lib/Class/MOP/Class.pm index a7c3ca3..45dfd46 100644 --- a/lib/Class/MOP/Class.pm +++ b/lib/Class/MOP/Class.pm @@ -1269,19 +1269,17 @@ sub _immutable_options { sub make_immutable { my ( $self, @args ) = @_; + return if not $self->is_mutable; + my ($file, $line) = (caller)[1..2]; - if ( $self->is_mutable ) { - $self->_initialize_immutable( - file => $file, - line => $line, - $self->_immutable_options(@args), - ); - $self->_rebless_as_immutable(@args); - return $self; - } - else { - return; - } + + $self->_initialize_immutable( + file => $file, + line => $line, + $self->_immutable_options(@args), + ); + $self->_rebless_as_immutable(@args); + return $self; } sub make_mutable {