This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate mainline
[perl5.git] / t / lib / filter-util.pl
1 sub readFile
2 {
3     my ($filename) = @_ ;
4     my ($string) = '' ;
5
6     open (F, "<$filename") 
7         or die "Cannot open $filename: $!\n" ;
8     while (<F>)
9       { $string .= $_ }
10     close F ;
11     $string ;
12 }
13
14 sub writeFile
15 {
16     my($filename, @strings) = @_ ;
17     open (F, ">$filename") 
18         or die "Cannot open $filename: $!\n" ;
19     binmode(F) if $filename =~ /bin$/i;
20     foreach (@strings)
21       { print F }
22     close F ;
23 }
24
25 sub ok
26 {
27     my($number, $result, $note) = @_ ;
28  
29     $note = "" if ! defined $note ;
30     if ($note) {
31         $note = "# $note" if $note !~ /^\s*#/ ;
32         $note =~ s/^\s*/ / ;
33     }
34
35     print "not " if !$result ;
36     print "ok ${number}${note}\n";
37 }
38
39 $Inc = '' ;
40 foreach (@INC)
41  { $Inc .= "\"-I$_\" " }
42
43 $Perl = '' ;
44 $Perl = ($ENV{'FULLPERL'} or $^X or 'perl') ;
45
46 $Perl = "$Perl -w" ;
47
48 1;