"Fossies" - the Fresh Open Source Software Archive

Member "PerlCDF38_0/testValidate.pl" (19 Nov 2019, 1815 Bytes) of package /linux/misc/PerlCDF38_0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "testValidate.pl" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 36_4_vs_37_0.

    1 
    2 
    3 #
    4 # testValidate
    5 #
    6 #   This program optionally validates the passed CDF file.
    7 #   See README.
    8 #
    9 #  Usage:
   10 #     perl testValidate.pl a_cdf_file
   11 #
   12 # Written By:
   13 #
   14 #    Mike H. Liu
   15 #
   16 #    17 July, 2009
   17 #
   18 
   19 use strict;
   20 
   21 BEGIN { unshift @INC,'/home/liu/PerlCDF38_0/blib/arch',
   22                      '/home/liu/PerlCDF38_0/blib/lib'; }
   23 use CDF;
   24 
   25 my $file = $ARGV[0];
   26 
   27 #############################################################################
   28 # Display title.
   29 #############################################################################
   30 
   31 print "\nTesting Perl-CDF Data Validation\n\n";
   32 CDF::CDFsetValidate(&VALIDATEFILEon);
   33 # CDF::CDFsetValidate(&VALIDATEFILEoff);
   34 
   35 my $id; my $status;
   36 $status = CDF::CDFlib(&OPEN_, &CDF_, $file, \$id,
   37               &NULL_);
   38 QuitCDF ("1.0", $status) if ($status < &CDF_OK); 
   39 
   40 #############################################################################
   41 # Close CDF.
   42 #############################################################################
   43 
   44 $status = CDF::CDFlib (&CLOSE_, &CDF_,
   45                &NULL_);
   46 QuitCDF ("2.0", $status) if ($status < &CDF_OK) ;
   47 
   48 #############################################################################
   49 # Successful completion.
   50 #############################################################################
   51 print "Test completed successfully\n";
   52 exit;
   53 
   54 #############################################################################
   55 # QuitCDF.
   56 #############################################################################
   57 sub QuitCDF {
   58     my ($where, $status)=@_;
   59 
   60   print "Aborting at $where ...\n";
   61   if ($status < &CDF_OK) {
   62     my $text;
   63     CDF::CDFlib (&SELECT_, &CDF_STATUS_, $status,
   64            &GET_, &STATUS_TEXT_, \$text,
   65            &NULL_);
   66     print $text;
   67   }
   68   CDF::CDFlib (&CLOSE_, &CDF_,
   69       &NULL_);
   70   print "...test aborted.\n";
   71   exit;
   72     
   73 }#endsub QuitCDF
   74