X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=scpubgit%2FQ-Branch.git;a=blobdiff_plain;f=lib%2FSQL%2FAbstract.pm;h=dda7fc5b89c46e945a1a8a9140aefd434f9a98b4;hp=9d9e20478ca057e9bf447acba4490401b7271c66;hb=cf5b7ab163f8ac123ebc9bb1156e79646cd5bd2f;hpb=9642099c07a86cc125dea4de321b67d5ef3c3495 diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index 9d9e204..dda7fc5 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -301,6 +301,11 @@ sub new { s/\A\s+//, s/\s+\Z// for $sql; return [ $sql, @bind ]; }; + $opt{expand_op}{ident} = sub { + my ($self, undef, $body) = @_; + $body = $body->from if Scalar::Util::blessed($body); + $self->_expand_ident(ident => $body); + }; } } @@ -344,7 +349,7 @@ sub make_binop_expander { sub plugin { my ($self, $plugin, @args) = @_; unless (ref $plugin) { - $plugin =~ s/\A\+/${\ref($self)}::Plugin::/; + $plugin =~ s/\A\+/${\__PACKAGE__}::Plugin::/; require(join('/', split '::', $plugin).'.pm'); } $plugin->apply_to($self, @args); @@ -358,8 +363,11 @@ BEGIN { my $name = join '_', reverse split '_', $type; my $singular = "${type}er"; - eval qq{sub ${singular} { shift->${singular}s(\@_) }; 1 } - or die "Method builder failed for ${singular}: $@"; + eval qq{sub ${singular} { + my \$self = shift; + return \$self->_ext_rw('${name}', \@_) if \@_ == 1; + return \$self->${singular}s(\@_) + }; 1 } or die "Method builder failed for ${singular}: $@"; eval qq{sub wrap_${singular} { shift->wrap_${singular}s(\@_) }; 1 } or die "Method builder failed for wrap_${singular}: $@";