AnyEvent-Git-Wrapper
view release on metacpan or search on metacpan
execute the git binary, if the last argument is either a code reference
or an AnyEvent condition variable, then the command is run in
non-blocking mode and the result will be sent to the condition variable
when the command completes. For most commands (all those but status,
log and version), the result comes back via the recv method on the
condition variable as two array references, one representing the
standard out and the other being the standard error. Because recv will
return just the first value if called in scalar context, you can
retrieve just the output by calling recv in scalar context.
# ignoring stderr
$git->branch(sub {
my $out = shift->recv;
foreach my $line (@$out)
{
...
}
});
# same thing, but saving stderr
$git->branch(sub {
my($out, $err) = shit->recv;
foreach my $line(@$out)
{
...
}
});
Like Git::Wrapper, you can also access the standard output and error
via the OUT and ERR, but care needs to be taken that you either save
to send the results of the command. If you provide a code reference it
will create its own condition variable and attach the code reference to
its callback. Either way it will return the condition variable.
# blocking
$git->RUN($command, @arguments);
# non-blocking callback
$git->RUN($command, @arguments, sub {
# $out is a list ref of stdout
# $err is a list ref of stderr
my($out, $err) = shift->recv;
});
# non-blocking cv
my $cv = $git->RUN($command, @arguments, AE::cv);
$cv->cb(sub {
my($out, $err) = shift->recv;
});
status
lib/AnyEvent/Git/Wrapper.pm view on Meta::CPAN
my $customize;
$customize = pop if ref($_[-1]) eq 'CODE';
my ($parts, $in) = Git::Wrapper::_parse_args( $cmd, @_ );
my @out;
my @err;
my $ipc = AnyEvent::Open3::Simple->new(
on_stdout => \@out,
on_stderr => \@err,
on_error => sub {
#my($error) = @_;
$cv->croak(
Git::Wrapper::Exception->new(
output => \@out,
error => \@err,
status => -1,
)
);
},
lib/AnyEvent/Git/Wrapper.pm view on Meta::CPAN
This module provides a non-blocking and blocking API for git in the style and using the data
structures of L<Git::Wrapper>. For methods that execute the git binary, if the last argument is
either a code reference or an L<AnyEvent> condition variable, then the command is run in
non-blocking mode and the result will be sent to the condition variable when the command completes.
For most commands (all those but C<status>, C<log> and C<version>), the result comes back via the
C<recv> method on the condition variable as two array references, one representing the standard out
and the other being the standard error. Because C<recv> will return just the first value if
called in scalar context, you can retrieve just the output by calling C<recv> in scalar context.
# ignoring stderr
$git->branch(sub {
my $out = shift->recv;
foreach my $line (@$out)
{
...
}
});
# same thing, but saving stderr
$git->branch(sub {
my($out, $err) = shit->recv;
foreach my $line(@$out)
{
...
}
});
Like L<Git::Wrapper>, you can also access the standard output and error via the C<OUT> and C<ERR>, but care
needs to be taken that you either save the values immediately if other commands are being run at the same
lib/AnyEvent/Git/Wrapper.pm view on Meta::CPAN
If you provide this method with a condition variable it will use that to send the results of the
command. If you provide a code reference it will create its own condition variable and attach
the code reference to its callback. Either way it will return the condition variable.
# blocking
$git->RUN($command, @arguments);
# non-blocking callback
$git->RUN($command, @arguments, sub {
# $out is a list ref of stdout
# $err is a list ref of stderr
my($out, $err) = shift->recv;
});
# non-blocking cv
my $cv = $git->RUN($command, @arguments, AE::cv);
$cv->cb(sub {
my($out, $err) = shift->recv;
});
=head2 status
xt/author/pod_spelling_system.t view on Meta::CPAN
if -r $config_filename;
plan skip_all => 'disabled' if $config->{pod_spelling_system}->{skip};
chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir));
add_stopwords(@{ $config->{pod_spelling_system}->{stopwords} });
add_stopwords(qw(
Plicease
stdout
stderr
stdin
subref
loopback
username
os
Ollis
Mojolicious
plicease
CPAN
reinstall
( run in 1.522 second using v1.01-cache-2.11-cpan-49f99fa48dc )