Steven Haryanto

NAME

Perinci::Tx::Util - Helper when writing transactional functions

VERSION

version 0.38

SYNOPSIS

 use Perinci::Tx::Util qw(use_other_actions);

 sub foo {
     my %args = @_;
     use_other_actions(actions => [
         ["My::action1", {arg=>1}],
         ["My::action2", {arg=>2}],
         # ...
     ]);
 }

FUNCTIONS

use_other_actions(actions=>$actions) => RES

Generate envelope response for transactional function. Can be used to say that function entirely depends on other actions.

Each action in $actions will be called with -tx_action => 'check_state'. If all actions return 304, response status will be 304. If some or all actions return 200 and the rest 304, response status will be 200 with undo_actions result metadata taken from the actions' metadata and do_actions from $actions. If any action returns 412, response will be 412. If any action return other status, response will be 500 (error).

It is your responsibility to load required modules.

Does not perform checking on actions like Perinci::Tx::Manager, but eventually actions will be checked by Perinci::Tx::Manager anyway.

SEE ALSO

Perinci::Util

Perinci

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/Perinci-Tx-Util.

SOURCE

Source repository is at https://github.com/sharyanto/perl-Perinci-Tx-Util.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Perinci-Tx-Util

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

AUTHOR

Steven Haryanto <stevenharyanto@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Steven Haryanto.

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