Commits

Palmer, 2E0EOL  committed 1726806

Check that a specific version (or later) is installed.

  • Participants
  • Parent commits 25c7e77
  • Branches f/201201-palmer-exp

Comments (0)

Files changed (1)

File t/example1.t

 
 use constant EXIT_SUCCESS => (0);
 use constant EXIT_FAILURE => (1);
+
+use constant MIN_VERSION => '0.1.0';
+#----------------------------------------------------------------------------
+sub CheckVersion()
+{
+	if ( $Daybo::Checksum::Base::VERSION lt MIN_VERSION() ) {
+		printf(
+			STDERR "Error: Daybo::Checksum %s required, %s installed.\n",
+			MIN_VERSION(), $Daybo::Checksum::Base::VERSION
+		);
+		return 0;
+	}
+	return 1;
+}
 #----------------------------------------------------------------------------
 sub Main()
 {
 	my $reader = Daybo::Checksum::Reader->new();
 
 	getopts('v', \%opts);
+	return EXIT_FAILURE() unless CheckVersion();
 	$readCount = $reader->Read(FileName => INPUT_CHECKSUM_FILE());
 	if ( $readCount ) {
 		printf("Read %d checksums from %s\n", $readCount, $reader->FileName())