[Rt-devel] DBIx::SB::Handle -- $PrevHandle question.

Jesse Vincent jesse at bestpractical.com
Wed Feb 21 16:33:23 EST 2007




On Wed, Feb 21, 2007 at 04:28:35PM -0500, Dmitri Tikhonov wrote:
> Dear RTers and DBIx::SBers,
> 
> what is the purpose of $PrevHandle "magic" in
> DBIx::SearchBuilder::Handle?  Specifically, this code:
> 
>   sub dbh {
>     my $self=shift;
> 
>     #If we are setting the database handle, set it.
>     $DBIHandle{$self} = $PrevHandle = shift if (@_);
> 
>     return($DBIHandle{$self} ||= $PrevHandle);
>   }
> 
> puzzles me.  The conversion from $DBIHandle to %DBIHandle is based on
> patch from Audrey Tang [1] which was included along with $PrevHandle
> into the 0.61 -> 0.96 changeset [2].  However, I can't find the
> explanation for $PrevHandle in the Changes file or anywhere in the
> comments.  Could someone please tell me why it's there?

I believe that this made SB able to handle a temporary dbh change if you
needed to open a new handle, work and then go back to what you were
doing.

> 
> Thank you,
> 
>   - Dmitri.
> 
> 
> 1. http://rt.cpan.org/Public/Bug/Display.html?id=4167
> 2. 
> http://search.cpan.org/diff?from=DBIx-SearchBuilder-0.61&to=DBIx-SearchBuilder-0.96
> _______________________________________________
> List info: http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel
> 

-- 


More information about the Rt-devel mailing list