NAME

DBIO::Future - Future interface contract for async DBIO operations

VERSION

version 0.900000

DESCRIPTION

Defines the interface contract that all DBIO-compatible Future objects must implement. This is not a base class -- async distributions bring their own Future implementation (Future, Mojo::Promise, etc.).

The interface is intentionally minimal to maximize compatibility across event loop ecosystems.

METHODS

validate

DBIO::Future->validate($obj);

Verifies that $obj implements the required Future interface. Croaks if any required method is missing.

REQUIRED METHODS

Any object returned by DBIO async methods must support these methods:

then
$future->then(sub { my @result = @_; ... });

Success callback. Called with the resolved values when the Future completes successfully. Must return a new Future.

catch
$future->catch(sub { my $error = shift; ... });

Error callback. Called with the error when the Future fails. Must return a new Future.

get
my @result = $future->get;

Block until the Future is resolved and return the result. Dies if the Future failed.

is_ready
if ($future->is_ready) { ... }

Returns true if the Future has been resolved (either success or failure).

is_failed
if ($future->is_failed) { ... }

Returns true if the Future was resolved with an error.

AUTHOR

DBIO & DBIx::Class Authors

COPYRIGHT AND LICENSE

Copyright (C) 2026 DBIO Authors Portions Copyright (C) 2005-2025 DBIx::Class Authors Based on DBIx::Class, heavily modified.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.