Skip Menu |

This queue is for tickets about the DBIx-AnyDBD CPAN distribution.

Report information
The Basics
Id: 5661
Status: stalled
Priority: 0/
Queue: DBIx-AnyDBD

People
Owner: NHORNE [...] cpan.org
Requestors: EVO [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in:
  • 1.00
  • 2.00
Fixed in: (no value)



Subject: Add new_with_dbh method
I've been using DBIx::AnyDBD to build DBIx::SQLEngine, and it's been lovely -- thanks! Based on a user request coded up a method that seemed like it might be a natural fit to add to your module. Specifically, I've received a request to allow someone to instantiate an object around an existing DBI database handle. Looking at the code, this could be done with a method more or less as follows: sub new_with_dbh { my ($class, $dbh, $package) = @_; my $self = bless { 'package'=>$package, 'dbh'=>$dbh }, $class; $self->rebless; $self->_init if $self->can('_init'); return $self; } This is effectively the same as the last four lines of the new() and connect() subs, which could be refactored to call this method instead. Of course, I can do all of this from within my package, so it's not a real limitation, but as I say, it did seem like a natural suggestion to pass along for your consideration; I would imagine that there are some other users out there who might find this valuable as well.
Fixed in github - very late and probably no longer needed. https://github.com/nigelhorne/DBIx-AnyDBD Marked as stalled until release 2.03 is out.