On Wed May 25 11:12:22 2005, guest wrote:
Show quoted text> Cvs.pm version 0.07
> perl, v5.8.6 built for i686-linux
> Slackware Linux 10.1 kernel 2.4.30
>
> Error message:
>
> Can't locate object method "is_modified" via package
> "Cvs::Result::Base" at cvstest.pl line 9.
>
> Code:
>
> #!/usr/bin/perl -w
> use Cvs;
> use Env qw( $CVSROOT );
>
> my $file = 'testfile';
>
> my $cvs = new Cvs(cvsroot => "$CVSROOT") || die $Cvs::ERROR;
> my $status = $cvs->status('$file');
> if ($status->is_modified)
> {
> $cvs->commit("$file");
> }
There are two factors at work here: firstly, status() requires that the
files be in a workdir, and the example fails because none is specified;
secondly, the way the module's error handling works is by returning an
instance of Cvs::Result::Base, with the error message accessible via the
error() accessor method. Cvs::Result::Base has no is_modified() method,
hence the run-time error seen here.
The first problem is trivially fixable by supplying a workdir argument
to new(), e.g.
my $cvs = new Cvs( '/path/to/my/workdir', cvsroot => "$CVSROOT") || die
$Cvs::ERROR;
The second problem is more fundamental.