Skip Menu |

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

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

Owner: Nobody in particular
Requestors: EVO [...]

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

Subject: Add new_with_dbh method
Download (untitled) / with headers
text/plain 1007b
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.

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to