Collapse some repetitive code
authorFather Chrysostomos <sprout@cpan.org>
Thu, 2 Jun 2011 01:00:45 +0000 (18:00 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Thu, 2 Jun 2011 03:37:37 +0000 (20:37 -0700)
dist/B-Deparse/Deparse.pm

index fbc1c63..335b3c0 100644 (file)
@@ -2809,11 +2809,9 @@ sub pp_leavetry {
     return "eval {\n\t" . $self->pp_leave(@_) . "\n\b}";
 }
 
-BEGIN { eval "sub OP_CONST () {" . opnumber("const") . "}" }
-BEGIN { eval "sub OP_STRINGIFY () {" . opnumber("stringify") . "}" }
-BEGIN { eval "sub OP_RV2SV () {" . opnumber("rv2sv") . "}" }
-BEGIN { eval "sub OP_LIST () {" . opnumber("list") . "}" }
-BEGIN { eval "sub OP_GLOB () {" . opnumber("glob") . "}" }
+BEGIN { for (qw[ const stringify rv2sv list glob ]) {
+    eval "sub OP_\U$_ () { " . opnumber($_) . "}"
+}}
 
 sub pp_null {
     my $self = shift;