From: Matt S Trout Date: Sun, 17 Jul 2011 01:14:31 +0000 (+0000) Subject: move _render_dq call for _table to top level of method X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f9bfca4a088ae361327a0cb76dfaf9ccfade2c3f;p=dbsrgits%2FSQL-Abstract.git move _render_dq call for _table to top level of method --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index de2bb08..dda95a9 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -1214,38 +1214,40 @@ sub _order_by_chunks { sub _table { my $self = shift; my $from = shift; - $self->_SWITCH_refkind($from, { - ARRAYREF => sub { - die "Empty FROM list" unless my @f = @$from; - my $dq = { - type => DQ_IDENTIFIER, - elements => [ split /\Q$self->{name_sep}/, shift @f ], - }; - while (my $x = shift @f) { - $dq = { - type => DQ_JOIN, - join => [ $dq, { - type => DQ_IDENTIFIER, - elements => [ split /\Q$self->{name_sep}/, $x ], - } ], + $self->_render_dq( + $self->_SWITCH_refkind($from, { + ARRAYREF => sub { + die "Empty FROM list" unless my @f = @$from; + my $dq = { + type => DQ_IDENTIFIER, + elements => [ split /\Q$self->{name_sep}/, shift @f ], }; - } - $self->_render_dq($dq); - }, - SCALAR => sub { - $self->_render_dq({ - type => DQ_IDENTIFIER, - elements => [ split /\Q$self->{name_sep}/, $from ], - }) - }, - SCALARREF => sub { - $self->_render_dq({ - type => DQ_LITERAL, - subtype => 'SQL', - literal => $$from - }) - }, - }); + while (my $x = shift @f) { + $dq = { + type => DQ_JOIN, + join => [ $dq, { + type => DQ_IDENTIFIER, + elements => [ split /\Q$self->{name_sep}/, $x ], + } ], + }; + } + $dq; + }, + SCALAR => sub { + +{ + type => DQ_IDENTIFIER, + elements => [ split /\Q$self->{name_sep}/, $from ], + } + }, + SCALARREF => sub { + +{ + type => DQ_LITERAL, + subtype => 'SQL', + literal => $$from + } + }, + }) + ); }