Re: Time to Document Callbacks
by David E. Wheeler other posts by this author
Oct 25 2009 10:25PM messages near this date
Re: Time to Document Callbacks
|
Re: Time to Document Callbacks
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 that's not really
> recommended.)
>
> Thanks!
>
> Tim.
>
> p.s. Might be worth skimming through the archives
> http://tinyurl.com/yl582mt
Thanks. Following up on [this post](http://markmail.org/message/fus3dfauxs6yz6sv
), I wrote this code:
my $dbh = DBI-> connect('dbi:Pg:dbname=bric', '', '', {
Callbacks => {
execute => sub { print "Set in DBH\n"; return; }
}
});
my $sth = $dbh-> prepare('SELECT id FROM pref WHERE name = ?');
# $sth-> {Callbacks}{execute} = sub { print "Set in STH\n"; return; };
$sth-> execute('Time Zone');
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 attribute is not passed on
to statement handles created for the database handle? Seems a shameâ¦
Best,
David
Thread:
David E. Wheeler
Tim Bunce
David E. Wheeler
Tim Bunce
David E. Wheeler
David Nicol
Tim Bunce
David E. Wheeler
Tim Bunce
David E. Wheeler
Tim Bunce
David E. Wheeler
Tim Bunce
David E. Wheeler
H.Merijn Brand
Tim Bunce
David E . Wheeler
David E. Wheeler
David E. Wheeler
David E . Wheeler
|