# This module contains all code for checking API versions for the
# PVCS to Perforce converter.
#
# $Id: //guest/perforce_software/utils/pvcstop4/main/utils.pm#3 $
#
require 5.0;
package utils; # This package
use Exporter;
use vars qw(@ISA @EXPORT);
use convert;
@ISA = qw(Exporter);
# @EXPORT = qw(p4api p4exec p4errors_get p4errors_print log_ss_version);
@EXPORT = qw(p4api);
# Checks
sub p4api
{
my $p4perl_version = "08.2"; # Avoid duplicate :)
my $p4perl_version_reqd = "P4PERL/NTX86/20$p4perl_version";
my $usage = "\nP4Perl module (P4) is required for the converter to run.
Install P4Perl from the Perforce FTP site.
Please use version $p4perl_version_reqd - for example:
ftp://ftp.perforce.com/perforce/r$p4perl_version/bin.ntx86/p4perl58.exe
\n";
# Check that P4 Module is installed
eval{require P4; import P4;};
if ($@) {
print $usage;
exit(1);
}
my $ver = P4::Identify();
convert::log("P4Perl version: $ver\n");
if ($ver !~ /\s*$p4perl_version_reqd/) {
print $usage;
print "****** Wrong P4Perl version installed - $ver is what you have - please uninstall and install $p4perl_version_reqd instead!";
exit(1);
}
my $p4 = new P4;
$p4->SetProg("pvcstop4");
return $p4;
}
1;