NAME
App::karr::SyncGuard - Push guard with automatic retry on scope exit
VERSION
version 0.201
SYNOPSIS
my $guard = $self->sync_before; # git pull + return guard
# ... command logic ...
$self->sync_after; # explicit push
$guard->done; # mark guard as done (DESTROY no-ops)
undef $guard;
# If die/croak happens before sync_after:
# Guard DESTROY runs sync_after with 3 retries, then dies with clear error
DESCRIPTION
App::karr::SyncGuard is created by "sync_before" in App::karr::Role::SyncLifecycle. It acts as an insurance policy: if the command body dies or croaks before "sync_after" in App::karr::Role::SyncLifecycle is called explicitly, the guard's DESTROY runs sync_after with retry logic, ensuring refs are pushed even on failure.
METHODS
done
$guard->done;
Marks the guard as successfully completed. After this is called, the guard's DESTROY is a no-op. Call this after "sync_after" succeeds.
errs
my @errors = $guard->errs;
Returns the list of error messages from retry attempts.
SUPPORT
Issues
Please report bugs and feature requests on GitHub at https://github.com/Getty/karr/issues.
IRC
Join #langertha on irc.perl.org or message Getty directly.
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHOR
Torsten Raudssus <getty@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.