Re: Time to Document Callbacks

2010-03-08 Thread Martin Evans
Tim Bunce wrote: > On Sun, Mar 07, 2010 at 10:29:29AM -0800, David E. Wheeler wrote: >> On Mar 7, 2010, at 5:43 AM, Tim Bunce wrote: >> Looks good, thanks. Pity you removed the `$dbh->{private_myapp_sql_mode}` bit, though, as that's required when using C, which you almost certainly a

Re: Time to Document Callbacks

2010-03-07 Thread David E. Wheeler
On Mar 7, 2010, at 3:27 PM, Tim Bunce wrote: > Uh, yeah, I just looked at the code. Sometimes I confuse myself. > I think that's a bug. I always intended connected() to be used as an > on-new-physical-connection-established hook. > > Any objections to making it so? Not from me, but you might get

Re: Time to Document Callbacks

2010-03-07 Thread Tim Bunce
On Sun, Mar 07, 2010 at 10:29:29AM -0800, David E. Wheeler wrote: > On Mar 7, 2010, at 5:43 AM, Tim Bunce wrote: > > >> Looks good, thanks. Pity you removed the `$dbh->{private_myapp_sql_mode}` > >> bit, though, as that's required when using C, which > >> you almost certainly are doing if you need

Re: Time to Document Callbacks

2010-03-07 Thread David E. Wheeler
On Mar 7, 2010, at 5:43 AM, Tim Bunce wrote: >> Looks good, thanks. Pity you removed the `$dbh->{private_myapp_sql_mode}` >> bit, though, as that's required when using C, which >> you almost certainly are doing if you need this hack. > > Are you sure it's required when using connected()? The conn

Re: Time to Document Callbacks

2010-03-07 Thread Tim Bunce
On Sat, Mar 06, 2010 at 04:07:09PM -0800, David E. Wheeler wrote: > On Mar 6, 2010, at 3:45 PM, Tim Bunce wrote: > > > I was tempted to leave "The cool thing is" but opted to drop it as it > > doesn't match the tone of the rest of the docs - although they are > > rather dry :) > > Pity. Thought I

Re: Time to Document Callbacks

2010-03-06 Thread David E. Wheeler
On Mar 6, 2010, at 3:45 PM, Tim Bunce wrote: > I was tempted to leave "The cool thing is" but opted to drop it as it > doesn't match the tone of the rest of the docs - although they are > rather dry :) Pity. Thought I was starting to change that. ;-P > I've made assorted edits and added some ext

Re: Time to Document Callbacks

2010-03-06 Thread Tim Bunce
On Tue, Mar 02, 2010 at 05:08:21PM -0800, David E. Wheeler wrote: > Howdy, > > I've just committed r13835, which documents Callbacks. Yay! A few notes: Great. Thanks! > * Tim, you earlier said: > > > I could arrange for Callbacks to only apply to methods called by the > > applicationi, and not

Re: Time to Document Callbacks

2010-03-02 Thread David E. Wheeler
Howdy, I've just committed r13835, which documents Callbacks. Yay! A few notes: * Tim, you earlier said: > I could arrange for Callbacks to only apply to methods called by the > applicationi, and not to 'nested calls'. That's a fairly major change > after this length of time but given the limite

Re: Time to Document Callbacks

2009-11-02 Thread Tim Bunce
On Fri, Oct 30, 2009 at 01:42:03PM +0100, H.Merijn Brand wrote: > On Fri, 30 Oct 2009 12:31:03 +, Tim Bunce > wrote: > > > On Thu, Oct 29, 2009 at 05:10:07PM -0700, David E. Wheeler wrote: > > > On Oct 29, 2009, at 4:24 PM, Tim Bunce wrote: > > > > > >> I could arrange for Callbacks to only a

Re: Time to Document Callbacks

2009-10-30 Thread H.Merijn Brand
On Fri, 30 Oct 2009 12:31:03 +, Tim Bunce wrote: > On Thu, Oct 29, 2009 at 05:10:07PM -0700, David E. Wheeler wrote: > > On Oct 29, 2009, at 4:24 PM, Tim Bunce wrote: > > > >> I could arrange for Callbacks to only apply to methods called by the > >> applicationi, and not to 'nested calls'. Th

Re: Time to Document Callbacks

2009-10-30 Thread Tim Bunce
On Thu, Oct 29, 2009 at 05:10:07PM -0700, David E. Wheeler wrote: > On Oct 29, 2009, at 4:24 PM, Tim Bunce wrote: > >> I could arrange for Callbacks to only apply to methods called by the >> applicationi, and not to 'nested calls'. That's a fairly major change >> after this length of time but given

Re: Time to Document Callbacks

2009-10-29 Thread David E . Wheeler
On Oct 29, 2009, at 5:10 PM, David E. Wheeler wrote: Well, yes. But if there were 'fetch*' and 'select*' keys that could go to all of them at once, that would be cool, too. I found another great use for callbacks: A callback on `connected()` to set things up for a handle the first time it c

Re: Time to Document Callbacks

2009-10-29 Thread David E. Wheeler
On Oct 29, 2009, at 4:24 PM, Tim Bunce wrote: I could arrange for Callbacks to only apply to methods called by the applicationi, and not to 'nested calls'. That's a fairly major change after this length of time but given the limited use Callbacks have had, and the lack of documentation, it's

Re: Time to Document Callbacks

2009-10-29 Thread Tim Bunce
On Wed, Oct 28, 2009 at 02:00:13PM -0700, David E. Wheeler wrote: > On Oct 28, 2009, at 1:55 PM, Tim Bunce wrote: > >> If you're applying a callback to the "fetch" method and then your code >> calls fetchrow_hashref, for example, how do you know if the driver's >> fetchrow_hashref() method calls fe

Re: Time to Document Callbacks

2009-10-28 Thread David E. Wheeler
On Oct 28, 2009, at 1:55 PM, Tim Bunce wrote: If you're applying a callback to the "fetch" method and then your code calls fetchrow_hashref, for example, how do you know if the driver's fetchrow_hashref() method calls fetch() or fetchrow_arrayref()? Franky, if I've applied a callback to `fetch

Re: Time to Document Callbacks

2009-10-28 Thread Tim Bunce
On Wed, Oct 28, 2009 at 10:26:49AM -0700, David E. Wheeler wrote: > On Oct 28, 2009, at 2:59 AM, Tim Bunce wrote: > >> Here's a deal: you write some tests for ChildCallbacks in >> t/70callbacks.t and I'll implement them. > > Deal. Great. Thanks. >>> Oh, nice. Does that mean you'll have more time

Re: Time to Document Callbacks

2009-10-28 Thread David E. Wheeler
On Oct 28, 2009, at 10:26 AM, David E. Wheeler wrote: Here's a deal: you write some tests for ChildCallbacks in t/70callbacks.t and I'll implement them. Deal. Done in r13445. Best, David

Re: Time to Document Callbacks

2009-10-28 Thread David E. Wheeler
On Oct 28, 2009, at 2:59 AM, Tim Bunce wrote: That looks nice. Are STHs the only things that are "children"? DBHs are children of DRHs (but I try to avoid talking about DRHs). Yes, let's pretend they don't exist here. Here's a deal: you write some tests for ChildCallbacks in t/70callbacks.

Re: Time to Document Callbacks

2009-10-28 Thread Tim Bunce
On Tue, Oct 27, 2009 at 06:07:46PM -0700, David E. Wheeler wrote: > On Oct 27, 2009, at 3:24 PM, Tim Bunce wrote: > >> The "simplest thing that could possibly work" is probably: >> >>$dbh->{Callbacks} = { >>method_foo => sub { ... }, >>method_bar => sub { ... }, >>ChildC

Re: Time to Document Callbacks

2009-10-28 Thread David Nicol
On Tue, Oct 27, 2009 at 2:50 PM, David E. Wheeler wrote: >> Ideally I'd like to see an abstract interface for managing callbacks, >> rather than the current "stuff it in a hash". That way future support >> for post-method callbacks and multi-callbacks per method and handle >> could be added withou

Re: Time to Document Callbacks

2009-10-27 Thread David E. Wheeler
On Oct 27, 2009, at 3:24 PM, Tim Bunce wrote: The "simplest thing that could possibly work" is probably: $dbh->{Callbacks} = { method_foo => sub { ... }, method_bar => sub { ... }, ChildCallbacks => { method_foo => sub { ... }, method_bar => sub { .

Re: Time to Document Callbacks

2009-10-27 Thread Tim Bunce
On Tue, Oct 27, 2009 at 12:50:15PM -0700, David E. Wheeler wrote: > On Oct 26, 2009, at 1:59 PM, Tim Bunce wrote: > >>> It output nothing. When I uncommented that second-to-last line, it output >>> "Set in STH". So it seems that a callback added to the dbh for a >>> statement >>> method name does

Re: Time to Document Callbacks

2009-10-27 Thread David E. Wheeler
On Oct 27, 2009, at 1:38 PM, David Nicol wrote: one would do $sth->AddPostCallback( fetch => sub { my ($sth, $row) = @_; $row->[3] = DateTime::Format::Pg->parse_datetime($row->[3]); }); +1 David

Re: Time to Document Callbacks

2009-10-27 Thread David E. Wheeler
On Oct 26, 2009, at 1:59 PM, Tim Bunce wrote: It output nothing. When I uncommented that second-to-last line, it output "Set in STH". So it seems that a callback added to the dbh for a statement method name does not end up getting passed on to the statement handle. So I guess the Callbacks

Re: Time to Document Callbacks

2009-10-26 Thread Tim Bunce
On Sun, Oct 25, 2009 at 10:24:57PM -0700, David E. Wheeler wrote: > On Oct 24, 2009, at 2:50 PM, Tim Bunce wrote: > >> Callbacks are handled by the method dispatcher so all method names are >> valid (so don't bother trying to list them in the docs :) >> >> Plus the two special cases for connect_cac

Re: Time to Document Callbacks

2009-10-25 Thread David E . Wheeler
On Oct 25, 2009, at 10:24 PM, David E. Wheeler wrote: It output nothing. When I uncommented that second-to-last line, it output "Set in STH". So it seems that a callback added to the dbh for a statement method name does not end up getting passed on to the statement handle. So I guess the Ca

Re: Time to Document Callbacks

2009-10-25 Thread David E. Wheeler
On Oct 24, 2009, at 2:50 PM, Tim Bunce wrote: Callbacks are handled by the method dispatcher so all method names are valid (so don't bother trying to list them in the docs :) Plus the two special cases for connect_cached: 'connect_cached.new' and 'connect_cached.reused'. (There's also '*' but

Re: Time to Document Callbacks

2009-10-24 Thread Tim Bunce
On Sat, Oct 24, 2009 at 08:45:42AM -0700, David E. Wheeler wrote: > Tim, > > I think it's high time we documented callbacks. I'm pretty sure the > DBIx::Class folks are going to want to make use of them shortly. I'd be > happy to contribute the docs. Great! > Is there a way to get a list of all

Time to Document Callbacks

2009-10-24 Thread David E. Wheeler
Tim, I think it's high time we documented callbacks. I'm pretty sure the DBIx::Class folks are going to want to make use of them shortly. I'd be happy to contribute the docs. Is there a way to get a list of all possible callback keys? Thanks, David