From: Graham Knop Date: Sun, 22 Sep 2013 07:56:19 +0000 (-0400) Subject: whitespace/style cleanups X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ae27a450f2cac80bb12c6d6a06ad0f67d2f08298;p=gitmo%2FMoo.git whitespace/style cleanups --- diff --git a/lib/Method/Generate/Accessor.pm b/lib/Method/Generate/Accessor.pm index 0f71acf..d0ab970 100644 --- a/lib/Method/Generate/Accessor.pm +++ b/lib/Method/Generate/Accessor.pm @@ -24,9 +24,9 @@ sub _SIGDIE my $sigdie = $OrigSigDie && $OrigSigDie != \&_SIGDIE ? $OrigSigDie : sub { die $_[0] }; - + return $sigdie->(@_) if ref($_[0]); - + my $attr_desc = _attr_desc(@$CurrentAttribute{qw(name init_arg)}); $sigdie->("$CurrentAttribute->{step} for $attr_desc failed: $_[0]"); } @@ -170,7 +170,7 @@ sub generate_method { _die_overwrite($into, $cl, 'a clearer') if !$spec->{allow_overwrite} && *{_getglob("${into}::${cl}")}{CODE}; $methods{$cl} = - quote_sub "${into}::${cl}" => + quote_sub "${into}::${cl}" => $self->_generate_simple_clear('$_[0]', $name, $spec)."\n" ; } @@ -339,7 +339,7 @@ sub _generate_set { $code = "do { my \$self = shift;\n"; } if ($isa_check) { - $code .= + $code .= " ".$self->_generate_isa_check($name, $value_store, $isa_check).";\n"; } my $simple = $self->_generate_simple_set('$self', $name, $spec, $value_store); @@ -378,7 +378,7 @@ sub _generate_coerce { $self->_generate_call_code($name, 'coerce', "${value}", $coerce) ); } - + sub generate_trigger { my $self = shift; $self->{captures} = {}; @@ -462,7 +462,7 @@ sub _generate_populate_set { my $get_default = $self->_generate_get_default( '$new', $name, $spec ); - my $get_value = + my $get_value = defined($spec->{init_arg}) ? "(\n${get_indent} ${test}\n${get_indent} ? ${source}\n${get_indent} : " .$get_default diff --git a/lib/Moo.pm b/lib/Moo.pm index c1d09a4..31a52ce 100644 --- a/lib/Moo.pm +++ b/lib/Moo.pm @@ -121,7 +121,7 @@ sub _accessor_maker_for { $MAKERS{$target}{accessor} ||= do { my $maker_class = do { if (my $m = do { - if (my $defer_target = + if (my $defer_target = (Sub::Defer::defer_info($target->can('new'))||[])->[0] ) { my ($pkg) = ($defer_target =~ /^(.*)::[^:]+$/); @@ -166,7 +166,7 @@ sub _constructor_maker_for { } else { $moo_constructor = 1; # no other constructor, make a Moo one } - }; + } ($con ? ref($con) : 'Method::Generate::Constructor') ->new( package => $target, diff --git a/lib/Moo/HandleMoose.pm b/lib/Moo/HandleMoose.pm index 3d896f8..ec745cf 100644 --- a/lib/Moo/HandleMoose.pm +++ b/lib/Moo/HandleMoose.pm @@ -50,7 +50,6 @@ sub inject_fake_metaclass_for { sub _uninlined_body { \&Moose::Object::new } } - sub inject_real_metaclass_for { my ($name) = @_;