From: Dave Rolsky Date: Fri, 11 Sep 2009 17:28:11 +0000 (-0500) Subject: Small refactoring to simplify generating code a bit X-Git-Tag: 0.90~47 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6eff32cb0a932c52b0f65e9fbbcc99508cb734d1;p=gitmo%2FMoose.git Small refactoring to simplify generating code a bit --- diff --git a/lib/Moose/Meta/Method/Destructor.pm b/lib/Moose/Meta/Method/Destructor.pm index 627634a..1fce623 100644 --- a/lib/Moose/Meta/Method/Destructor.pm +++ b/lib/Moose/Meta/Method/Destructor.pm @@ -83,12 +83,10 @@ sub _initialize_body { $source = 'sub {'; $source .= 'local ( $., $@, $!, $^E, $? );' . "\n"; - my @DEMOLISH_calls; - foreach my $method (@DEMOLISH_methods) { - push @DEMOLISH_calls => '$_[0]->' . $method->{class} . '::DEMOLISH()'; - } - - $source .= join ";\n" => @DEMOLISH_calls; + $source + .= join ";\n" => + map { '$_[0]->' . $_->{class} . '::DEMOLISH()' } + @DEMOLISH_methods; $source .= ";\n" . '}'; } else {