Git::Background::Future - use Future with Git::Background
Version 0.008
use Git::Background 0.008; my $future = Git::Background->run(qw(status -s)); my @stdout = $future->stdout; my ($stdout_ref, $stderr_ref, $exit_code, $stdout_path, $stderr_path) = $future->get;
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.
Future
The default is to read the output from Git on its stdout and stderr as UTF-8.
The strings returned by the get, stderr, and stdout methods can therefore contain wide characters. When you write this data to a file handle, you must ensure that the destination also uses a suitable encoding. This is necessary to correctly handle any wide characters in the data. You can do this by setting the encoding of the destination filehandle, e.g.:
get
stderr
stdout
binmode(STDOUT, ':encoding(UTF-8)');
New Git::Background::Future objects should be constructed by using the run method of Git::Background.
Git::Background::Future
run
Current API available since 0.002.
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.
failure
See "await" in Future for more information.
Calls get, then returns the exit code of the Git process.
Because this command calls get, the same exceptions can be thrown.
Waits for the running Git process to finish by calling await. Returns undef if the future finished successfully, otherwise it returns a list with
await
$message, $category, @details
For the $category git, @details is a list of stdout_ref, stderr_ref, exit_code, stdout_path, and stderr_path. See get for a description of these values.
$category
git
@details
stdout_ref
stderr_ref
exit_code
stdout_path
stderr_path
Current API available since 0.008.
Waits for the running Git process to finish by calling await. Throws a Future::Exception if the Future didn't finish successfully. Returns a list of stdout_ref, stderr_ref, exit_code, stdout_path, and stderr_path.
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;
An array reference containing the stdout from git, split into lines and chomped.
An array reference containing the stderr from git, split into lines and chomped.
The exit code from git.
A Path::Tiny object of a file containing the stdout from Git. This can be used to read the data with a different binmode.
A Path::Tiny object of a file containing the stderr from Git.
"is_done" in Future
"is_failed" in Future
"is_ready" in Future
Calls get, then returns the Path::Tiny object for the file containing the stderr from Git.
Calls get, then returns the Path::Tiny object for the file containing the stdout from Git.
"state" in Future
Calls get, then returns all the lines written by the Git command to stderr.
Note: get returns all the output lines as array reference, stderr returns a list.
Calls get, then returns all the lines written by the Git command to stdout.
Note: get returns all the output lines as array reference, stdout returns a list.
Git::Background, Future, Path::Tiny
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.
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
Sven Kirmess <sven.kirmess@kzone.ch>
To install Git::Background, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Git::Background
CPAN shell
perl -MCPAN -e shell install Git::Background
For more information on module installation, please visit the detailed CPAN module installation guide.