THERE ARE FOUR LIGHTS
[scpubgit/Q-Branch.git] / lib / SQL / Abstract.pm
index 1d4a14d..6389394 100644 (file)
@@ -327,6 +327,15 @@ sub make_binop_expander {
   }
 }
 
+sub plugin {
+  my ($self, $plugin, @args) = @_;
+  unless (ref $plugin) {
+    $plugin =~ s/\A\+/${\ref($self)}::Plugin::/;
+    require(join('/', split '::', $plugin).'.pm');
+  }
+  $plugin->apply_to($self, @args);
+}
+
 BEGIN {
   foreach my $type (qw(
     expand op_expand render op_render clause_expand clause_render
@@ -3449,11 +3458,17 @@ When supplied with a coderef, it is called as:
 
 =back
 
-=head1 NEW METHODS
+=head1 NEW METHODS (EXPERIMENTAL)
 
 See L<SQL::Abstract::Reference> for the C<expr> versus C<aqt> concept and
 an explanation of what the below extensions are extending.
 
+=head2 plugin
+
+  $sqla->plugin('+Foo');
+
+Enables plugin SQL::Abstract::Plugin::Foo.
+
 =head2 render_expr
 
   my ($sql, @bind) = $sqla->render_expr($expr);