NAME

DBIx::Fast::Connector - DBIx::Fast connection manager fork safe

DESCRIPTION

Minimal connection manager that provides automatic reconnection and fork safety.

METHODS

new

my $conn = DBIx::Fast::Connector->new(
    dsn        => $dsn,
    user       => $user,
    pass       => $pass,
    attrs      => \%attrs,
    on_connect => sub ($dbh) { ... },   # optional
);

Creates a new connector (named parameters). The DBI connection is established lazily on the first call to dbh. on_connect is a coderef invoked with the fresh handle on every (re)connect.

dbh

my $dbh = $conn->dbh;

Returns the DBI database handle. Automatically reconnects if the handle is stale or if the process has forked since the last connection. Dies with "connection lost mid-transaction" if a handle is found dead while a transaction was open (AutoCommit off), rather than silently reconnecting an autocommit session.

disconnect

Disconnects and clears the cached handle.

mode

Accepts a mode argument (ignored). Exists for compatibility.

AUTHOR

SeHarrys

LICENSE

This is free software under the Artistic License 2.0.