The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Git::Background::Future - use Future with Git::Background

VERSION

Version 0.005

SYNOPSIS

use Git::Background 0.002;
my $future = Git::Background->run(qw(status -s));

my @stdout = $future->stdout;

my ($stdout_ref, $stderr_ref, $exit_code) = $future->get;

DESCRIPTION

This is a subclass of Future. Please read the excellent documentation of Future to see what you can do with this module, this man page only describes the changes to Future specific to Git::Background.

USAGE

new( RUN )

New Git::Background::Future objects should be constructed by using the run method of Git::Background.

await

Blocks and waits until the Git process finishes.

Returns the invocant future itself, so it is useful for chaining.

This method is called by get or failure.

See "await" in Future for more information.

exit_code

Calls get, then returns the exit code of the Git process.

failure

Waits for the running Git process to finish by calling await. Returns undef if the future finished successfully, otherwise it returns a list with

$message, $category, @details

For the $category git @details is a list of stdout_ref, stderr_ref, and exit_code.

get

Waits for the running Git process to finish by calling await. Throws a Future::Exception if the Future didn't finish successfully. Returns the stdout, stderr and exit code of the Git process.

my $git = Git::Background->new($dir);
my $future = $git->run('status', '-s');
# waits for 'git status -s' to finish
my ($stdout_ref, $stderr_ref, $rc) = $future->get;

is_done

"is_done" in Future

is_failed

"is_failed" in Future

is_ready

"is_ready" in Future

state

"state" in Future

stderr

Calls get, then returns all the lines written by the Git command to stderr.

Because this command calls get, the same exceptions can be thrown.

Note: get returns all the output lines as array reference, stderr returns a list.

stdout

Calls get, then returns all the lines written by the Git command to stdout.

Because this command calls get, the same exceptions can be thrown.

Note: get returns all the output lines as array reference, stdout returns a list.

SEE ALSO

Git::Background, Future

SUPPORT

Bugs / Feature Requests

Please report any bugs or feature requests through the issue tracker at https://github.com/skirmess/Git-Background/issues. You will be notified automatically of any progress on your issue.

Source Code

This is open source software. The code repository is available for public review and contribution under the terms of the license.

https://github.com/skirmess/Git-Background

git clone https://github.com/skirmess/Git-Background.git

AUTHOR

Sven Kirmess <sven.kirmess@kzone.ch>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2021-2022 by Sven Kirmess.

This is free software, licensed under:

The (two-clause) FreeBSD License