1 2use strict ; 3use warnings; 4 5use vars qw( $Perl $Inc); 6 7sub readFile 8{ 9 my ($filename) = @_ ; 10 my ($string) = '' ; 11 12 open (F, "<$filename") 13 or die "Cannot open $filename: $!\n" ; 14 while (<F>) 15 { $string .= $_ } 16 close F ; 17 $string ; 18} 19 20sub writeFile 21{ 22 my($filename, @strings) = @_ ; 23 open (F, ">$filename") 24 or die "Cannot open $filename: $!\n" ; 25 binmode(F) if $filename =~ /bin$/i; 26 foreach (@strings) 27 { print F } 28 close F or die "Could not close: $!" ; 29} 30 31sub ok 32{ 33 my($number, $result, $note) = @_ ; 34 35 $note = "" if ! defined $note ; 36 if ($note) { 37 $note = "# $note" if $note !~ /^\s*#/ ; 38 $note =~ s/^\s*/ / ; 39 } 40 41 print "not " if !$result ; 42 print "ok ${number}${note}\n"; 43} 44 45$Inc = '' ; 46foreach (@INC) 47 { $Inc .= "\"-I$_\" " } 48$Inc = "-I::lib" if $^O eq 'MacOS'; 49 50$Perl = '' ; 51$Perl = ($ENV{'FULLPERL'} or $^X or 'perl') ; 52 53$Perl = "$Perl -MMac::err=unix" if $^O eq 'MacOS'; 54$Perl = "$Perl -w" ; 55 561; 57