The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Yancy::Backend::Role::Sync - A role to give a synchronous backend useful Promises methods

VERSION

version 1.006

SYNOPSIS

    package Yancy::Backend::SyncOnly;
    with 'Yancy::Backend::Role::Sync';

    package main;
    my $be = Yancy::Backend::SyncOnly->new;
    my $promise = $be->create_p( \%item );

DESCRIPTION

This role implements list_p, get_p, set_p, delete_p, and create_p methods that return Mojo::Promise objects for synchronous backends. This does not make the backend asynchronous: The original, synchronous method is called and a promise object created from the result. The promise is then returned already fulfilled.

If you have an asynchronous backend and want to allow users to use the synchronous API without implementing the methods yourself, see Yancy::Backend::Role::Sync.

SEE ALSO

Yancy::Backend, Yancy::Backend::Role::Async

AUTHOR

Doug Bell <preaction@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2018 by Doug Bell.

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