Re: abstract search count

[prev] [thread] [next] [Date index for 2004/06/17]

From: Jean-Christophe Zeus
Subject: Re: abstract search count
Date: 08:49 on 17 Jun 2004
On Jun 17, 2004, at 9:01 AM, Tony Bowden wrote:

> On Wed, Jun 16, 2004 at 04:45:45PM +0200, Jean-Christophe Zeus wrote:
>> Seems like no one is interested in our efforts. :-(
>
> I find it interesting...

Well, it's :-) then! Sorry for the self pity...

>> What about one abstract plugin (i.e. without any methods) that all the
>> others inherit from, thereby making writing plugins easier? I will
>> think this through, and if it really makes sense, I'll do it.
>
> I've also considered writing this. What would you expect it to do?

Well, first of all, I think that removing the symbol table hackery 
would be a good thing. My proposal is: all the plugin methods (not 
starting with an underscore) are injected into the caller's package 
automatically. Here's a prototype:

package Class::DBI::Plugin;
sub import
{
   my $class  = shift;
   my $caller = caller;
   no strict 'refs';
   for my $symname ( keys %{ "$class\::" } ) {
     local *sym = ${ "$class\::" }{ $symname };
     *{ "$caller\::$symname" } = \&sym
       if defined( &sym )
       and substr( $symname, 0, 1 ) ne '_';
   }
}

package Class::DBI::Plugin::SubClass;
use base 'Class::DBI::Plugin';
sub foo { print "inside foo()\n" }
sub bar { print "inside bar()\n" }
sub _baz { print "inside _baz()\n" }

# In a class inheriting form Class::DBI...
package Test;
use Class::DBI::Plugin::SubClass;

package main;
Test::foo();
Test::bar();
Test::_baz(); # fails

__END__

Next, I want to figure out how to inject the SQL etc.

What do you think?
        -- 
        J.-C Zeus (mail@xxxxxx.xxx)

(message missing)

abstract search count
Jean-Christophe Zeus 07:46 on 11 Jun 2004

RE: abstract search count
Jim Helm 16:15 on 14 Jun 2004

Re: abstract search count
Jean-Christophe Zeus 14:45 on 16 Jun 2004

Re: abstract search count
Tony Bowden 07:01 on 17 Jun 2004

Re: abstract search count
Jean-Christophe Zeus 08:49 on 17 Jun 2004

Re: abstract search count
Tony Bowden 09:11 on 17 Jun 2004

Re: abstract search count
Jean-Christophe Zeus 09:39 on 17 Jun 2004

Re: abstract search count
Stephen Quinney 10:06 on 17 Jun 2004

Re: abstract search count
Jean-Christophe Zeus 10:47 on 17 Jun 2004

Re: abstract search count
Stephen Quinney 10:53 on 17 Jun 2004

Re: abstract search count
Jean-Christophe Zeus 13:33 on 17 Jun 2004

Re: abstract search count
Simon Cozens 14:20 on 17 Jun 2004

Re: abstract search count
Jean-Christophe Zeus 14:26 on 17 Jun 2004

Generated at 11:35 on 01 Dec 2004 by mariachi v0.52