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.0009~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fb816aae3aa039ece22bc9eaff6574e9484d1837;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 267e376..458e282 100644 --- a/lib/Class/MOP/Class.pm +++ b/lib/Class/MOP/Class.pm @@ -1257,19 +1257,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 {