ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-dbi-dev
perl-dbi-dev
Re: Time to Document Callbacks
by David E . Wheeler other posts by this author
Oct 29 2009 5:20PM messages near this date
Re: Time to Document Callbacks | Re: Time to Document Callbacks
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 connects. Bricolage is  
using it for its MySQL support:

http://github.com/bricoleurs/bricolage/commit/68571810c4d79c73e7224471e008398ba9141a8d

The relevant code is:

     Callbacks =>  {
         connected =>  sub {
             my $dbh = shift;
             $dbh-> do(q{
                 SET SESSION  
sql_mode='ansi,strict_trans_tables,no_auto_value_on_zero';
             }) unless exists $dbh-> {private_bric_sql_mode};
             $dbh-> {private_bric_sql_mode} = 1;
             return;
         },
     },

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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved