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

NAME

Git::Wrapper::Plus::Util - Misc plumbing tools for Git::Wrapper::Plus

VERSION

version 0.004010

FUNCTIONS

exit_status_handler

Git::Wrapper throws exceptions in a few cases, and some of these cases are considered normal flow control for Git::Wrapper::Plus.

For instance, some functions in git emit no output, and return an exit code.

Git::Wrapper treats that circumstance as a fatal exception!.

Its messy getting all the right try/catch stuff going, and checking for the object type, and then checking if the exception type is recognized or not, and only then determining if the status was white-listed.

So:

    use Git::Wrapper::Plus::Util qw(exit_status_handler);

    my $ok = exit_status_handler ( $code , {
        1 => sub { undef }
    });

The above code normally executes $code, and returns 1 if no exception occurred.

If an exception occurred, and it is not a Git::Wrapper::Exception, it is simply re-thrown.

And for any status codes listed in the map, the attached sub is executed, and exit_status_handler propagates its return value.

Any other circumstances ( like a status code not existing in the map ) are simply re-thrown.

AUTHOR

Kent Fredric <kentfredric@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Kent Fredric <kentfredric@gmail.com>.

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