Cvs-Simple
view release on metacpan or search on metacpan
lib/Cvs/Simple.pm view on Meta::CPAN
=item callback ( CMD, CODEREF )
Specify a function pointed to by CODEREF to be executed for every line output
by CMD.
Permitted values of CMD are C<All> (executed on every line of
output), C<add>, C<commit>, C<checkout>, C<diff>, C<update>. CMD is also
permitted to be undef, in which case, it will be assumed to be C<All>.
cvs_cmd passes two arguments to callbacks: the actual command called, and the
line returned by CVS.
See the tests for examples of callbacks.
=item
=item unset_callback ( CMD )
Remove the callback set for CMD.
=item cvs_bin ( PATH )
Specifies the location and name of the CVS binary. Default to
C</usr/bin/cvs>.
=item cvs_cmd ( )
cvs_cmd() does the actual work of calling the equivalent CVS command. If any
callbacks have been set, they will be executed for every line received from
the command. If no callbacks have been set, all output is to STDOUT.
=item external( REPOSITORY )
Specify an "external" repository. This can be a genuinely remote
repository in C<:ext:user@repos.tld:/path/to/cvsroot> format, or an
alternative repository on the local host. This will be passed to the C<-d>
CVS global option.
=back
lib/Cvs/Simple.pm view on Meta::CPAN
=head2 EXPORT
None by default.
=head1 LIMITATIONS AND CAVEATS
=over 4
=item 1. Note that C<Cvs::Simple> carries out no input validation; everything is
passed on to CVS. Similarly, the caller will receive no response on the
success (or otherwise) of the transaction, unless appropriate callbacks have
been set.
=item 2. The C<cvs_cmd> method is quite simplistic; it's basically a pipe from
the equivalent CVS command line (with STDERR redirected). If a more
sophisticated treatment, over-ride C<cvs_cmd>, perhaps with something based on
C<IPC::Run> (as the L<Cvs> package does).
=item 3. This version of C<Cvs::Simple> has been developed against cvs version
1.11.19. Command syntax may differ in other versions of cvs, and
C<Cvs::Simple> method calls may fail in unpredictable ways if other versions
}
else {
$arg=~/U add_test_0[34].txt/ and ++$update_ok;
}
};
my($cvs) = Cvs::Simple->new();
isa_ok($cvs,'Cvs::Simple');
# Set our callbacks. Note that the 'add' callback
# is actually an 'update'.
$cvs->callback(update => $add_callback );
$cvs->callback(commit => $commit_callback);
SKIP: {
skip(q{Cvs not in $cvs->cvs_bin}, 7 ) unless (-x $cvs->cvs_bin );
my($cwd) = getcwd();
unless((splitdir($cwd))[-1] eq 't') {
t/08_status.t view on Meta::CPAN
if($line=~m{\A\s+working revision:\s+\d+\.\d+}i) {
++$status_ok;
}
push @stat_line, $line;
};
my($cvs) = Cvs::Simple->new();
isa_ok($cvs,'Cvs::Simple','ISA Cvs::Simple');
# Set our callbacks.
$cvs->callback(status => $status_callback );
is(reftype($cvs->callback('status')), 'CODE','Callback OK');
SKIP: {
skip(q{Cvs not in $cvs->cvs_bin}, 1 ) unless (-x $cvs->cvs_bin );
my($cwd) = getcwd();
unless((splitdir($cwd))[-1] eq 't') {
( run in 5.020 seconds using v1.01-cache-2.11-cpan-9b1e4054eb1 )