Skip to content
Snippets Groups Projects
DB.pm 824 B
package AccountManager::DB;

use strict;
use warnings;

use base 'Rose::DB';

__PACKAGE__->use_private_registry;

__PACKAGE__->SUPER::register_db (
    driver          => 'mysql',
    host            => 'localhost',
    database        => 'fake',
    password        => 'fake',
    username        => 'fake',
);

sub register_db {
    my ($pkg, %args) = @_;

    my $options = {
        AutoCommit => 1,
        ChopBlanks => 1,
    };
    if ($args{options}) {
        $options->{$_} = 1 foreach @{$args{options}};
    }

    __PACKAGE__->SUPER::register_db (
        connect_options => $options,
        driver          => $args{driver},
        host            => $args{host},
        database        => $args{database},
        password        => $args{password},
        username        => $args{username}
    );
}

1;