in reply to problem using Class::DBI with Class::Methodmaker
That use Class::MethodMaker new_with_init => 'new'; line is equivalent to adding the following subroutine declaration to your package:
sub new { my $class = shift; $class = ref $class || $class; my $self = {}; bless $self, $class; $self->init(@_); $self; };
Perhaps the problem is that Class::DBI provides its own constructor method which it expects you to call?
You might be able to do something more like the following:
package Foo::DBI; use base 'Class::DBI'; sub new { my $self = (shift)->SUPER::new( @_ ); $self->init(); return $self; } sub init { my $self->set_db('Main', 'dbi:mysql:database', 'user', 'pass +word'); }
|
|---|