From: Dave Rolsky Date: Thu, 16 Jun 2011 15:24:59 +0000 (-0500) Subject: code tidying X-Git-Tag: 2.0103~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=acf7adee8538ced9d892117274688a9cbd4e4e64;p=gitmo%2FMoose.git code tidying --- diff --git a/lib/Class/MOP/Class.pm b/lib/Class/MOP/Class.pm index 856053a..1482ade 100644 --- a/lib/Class/MOP/Class.pm +++ b/lib/Class/MOP/Class.pm @@ -1270,7 +1270,7 @@ sub _immutable_options { sub make_immutable { my ( $self, @args ) = @_; - return if not $self->is_mutable; + return unless $self->is_mutable; my ($file, $line) = (caller)[1..2]; @@ -1280,6 +1280,7 @@ sub make_immutable { $self->_immutable_options(@args), ); $self->_rebless_as_immutable(@args); + return $self; } diff --git a/lib/Moose/Meta/Class.pm b/lib/Moose/Meta/Class.pm index 01b548f..e3883f5 100644 --- a/lib/Moose/Meta/Class.pm +++ b/lib/Moose/Meta/Class.pm @@ -267,17 +267,17 @@ sub new_object { my $params = @_ == 1 ? $_[0] : {@_}; my $object = $self->SUPER::new_object($params); - $self->call_all_triggers($object, $params); + $self->_call_all_triggers($object, $params); $object->BUILDALL($params) if $object->can('BUILDALL'); return $object; } -sub call_all_triggers { +sub _call_all_triggers { my ($self, $object, $params) = @_; - foreach my $attr ($self->get_all_attributes()) { + foreach my $attr ( $self->get_all_attributes() ) { next unless $attr->can('has_trigger') && $attr->has_trigger; @@ -746,18 +746,19 @@ sub _immutable_options { ); } - sub _fixup_attributes_after_rebless { my $self = shift; my ($instance, $rebless_from, %params) = @_; - $self->SUPER::_fixup_attributes_after_rebless($instance, $rebless_from, %params); + $self->SUPER::_fixup_attributes_after_rebless( + $instance, + $rebless_from, + %params + ); - $self->call_all_triggers($instance, \%params); + $self->_call_all_triggers( $instance, \%params ); } - - ## ------------------------------------------------- our $error_level;