From: Dave Rolsky Date: Mon, 20 Apr 2009 15:13:29 +0000 (-0500) Subject: More perltidying X-Git-Tag: 0.82_01~11^2~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6446bd5941ae476f37009e390ba509937f8b57d2;p=gitmo%2FClass-MOP.git More perltidying --- diff --git a/lib/Class/MOP/Class/Immutable/Trait.pm b/lib/Class/MOP/Class/Immutable/Trait.pm index cd0380f..fa6448e 100644 --- a/lib/Class/MOP/Class/Immutable/Trait.pm +++ b/lib/Class/MOP/Class/Immutable/Trait.pm @@ -5,7 +5,7 @@ use warnings; use MRO::Compat; -use Carp 'confess'; +use Carp 'confess'; use Scalar::Util 'blessed', 'weaken'; sub meta { @@ -22,6 +22,7 @@ sub meta { # to dig a bit ... if ( $self->isa('Class::MOP::Class') ) { + # except this is a lie... oh well return Class::MOP::class_of( $self->get_mutable_metaclass_name ); } @@ -35,15 +36,17 @@ sub get_mutable_metaclass_name { $_[0]{__immutable}{original_class} } sub immutable_options { %{ $_[0]{__immutable}{options} } } -sub is_mutable { 0 } -sub is_immutable { 1 } +sub is_mutable {0} +sub is_immutable {1} sub superclasses { confess "This method is read-only" if @_ > 1; $_[0]->next::method; } -sub _immutable_cannot_call { Carp::confess "This method cannot be called on an immutable instance" } +sub _immutable_cannot_call { + Carp::confess "This method cannot be called on an immutable instance"; +} sub add_method { shift->_immutable_cannot_call } sub alias_method { shift->_immutable_cannot_call } @@ -52,19 +55,38 @@ sub add_attribute { shift->_immutable_cannot_call } sub remove_attribute { shift->_immutable_cannot_call } sub remove_package_symbol { shift->_immutable_cannot_call } -sub class_precedence_list { @{ $_[0]{__immutable}{class_precedence_list} ||= [ shift->next::method ] } } -sub linearized_isa { @{ $_[0]{__immutable}{linearized_isa} ||= [ shift->next::method ] } } -sub get_all_methods { @{ $_[0]{__immutable}{get_all_methods} ||= [ shift->next::method ] } } -sub get_all_method_names { @{ $_[0]{__immutable}{get_all_method_names} ||= [ shift->next::method ] } } -sub get_all_attributes { @{ $_[0]{__immutable}{get_all_attributes} ||= [ shift->next::method ] } } +sub class_precedence_list { + @{ $_[0]{__immutable}{class_precedence_list} + ||= [ shift->next::method ] }; +} + +sub linearized_isa { + @{ $_[0]{__immutable}{linearized_isa} ||= [ shift->next::method ] }; +} + +sub get_all_methods { + @{ $_[0]{__immutable}{get_all_methods} ||= [ shift->next::method ] }; +} + +sub get_all_method_names { + @{ $_[0]{__immutable}{get_all_method_names} ||= [ shift->next::method ] }; +} + +sub get_all_attributes { + @{ $_[0]{__immutable}{get_all_attributes} ||= [ shift->next::method ] }; +} -sub get_meta_instance { $_[0]{__immutable}{get_meta_instance} ||= shift->next::method } -sub get_method_map { $_[0]{__immutable}{get_method_map} ||= shift->next::method } +sub get_meta_instance { + $_[0]{__immutable}{get_meta_instance} ||= shift->next::method; +} + +sub get_method_map { + $_[0]{__immutable}{get_method_map} ||= shift->next::method; +} sub add_package_symbol { confess "Cannot add package symbols to an immutable metaclass" - unless ( caller(1) )[3] eq - 'Class::MOP::Package::get_package_symbol'; + unless ( caller(1) )[3] eq 'Class::MOP::Package::get_package_symbol'; shift->next::method(@_); }