From: Matt S Trout Date: Mon, 15 Apr 2019 01:02:36 +0000 (+0000) Subject: clean up op expansion X-Git-Tag: v1.90_01~214 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d390df44efe0afe3a68fc3b0437a51e9b7067b6e;p=dbsrgits%2FSQL-Abstract.git clean up op expansion --- diff --git a/lib/SQL/Abstract/Clauses.pm b/lib/SQL/Abstract/Clauses.pm index bbe6eb9..8fb800d 100644 --- a/lib/SQL/Abstract/Clauses.pm +++ b/lib/SQL/Abstract/Clauses.pm @@ -279,12 +279,15 @@ sub _ext_rw { return $self; } -sub expander { shift->_ext_rw(expand => @_) } -sub op_expander { shift->_ext_rw(expand_op => @_) } -sub renderer { shift->_ext_rw(render => @_) } -sub op_renderer { shift->_ext_rw(expand_op => @_) } -sub clause_expander { shift->_ext_rw(expand_clause => @_) } -sub clause_renderer { shift->_ext_rw(render_clause => @_) } +BEGIN { + foreach my $type (qw( + expand op_expand render op_renderer clause_expand clause_render + )) { + my $key = join '_', reverse split '_', $type; + eval qq{sub ${type}er { shift->_ext_rw($key => \@_) }; 1 } + or die "Method builder failed: $@"; + } +} sub clauses_of { my ($self, $of, @clauses) = @_;