clean up calling code w/new render convention
Matt S Trout [Tue, 16 Apr 2019 03:52:42 +0000 (03:52 +0000)]
lib/SQL/Abstract/ExtraClauses.pm

index c055b8b..7c534c1 100644 (file)
@@ -90,14 +90,15 @@ sub register_defaults {
     $self->render_aqt($setop);
   });
 
+  $self->renderer($_ => sub {
+    my ($self, $setop, $args) = @_;
+    $self->join_clauses(
+      ' '.$self->format_keyword(join '_', $setop, ($args->{type}||())).' ',
+      map [ $self->render_aqt($_) ], @{$args->{queries}}
+    );
+  }) for qw(union intersect except);
+
   foreach my $setop (qw(union intersect except)) {
-    $self->renderer($setop => sub {
-      my ($self, undef, $args) = @_;
-      $self->join_clauses(
-        ' '.$self->format_keyword(join '_', $setop, ($args->{type}||())).' ',
-        map [ $self->render_aqt($_) ], @{$args->{queries}}
-      );
-    });
 
     $self->clause_expander("select.${setop}" => sub {
       +(setop => $_[0]->expand_expr({