summaryrefslogtreecommitdiff
path: root/t/lib/filt-util.pl
blob: 1615873bc9d2d95abbab887ab85a33d4578d09ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
sub readFile
{
    my ($filename) = @_ ;
    my ($string) = '' ;

    open (F, "<$filename") 
	or die "Cannot open $filename: $!\n" ;
    while (<F>)
      { $string .= $_ }
    close F ;
    $string ;
}

sub writeFile
{
    my($filename, @strings) = @_ ;
    open (F, ">$filename") 
	or die "Cannot open $filename: $!\n" ;
    binmode(F) if $filename =~ /bin$/i;
    foreach (@strings)
      { print F }
    close F ;
}

sub ok
{
    my($number, $result, $note) = @_ ;
 
    $note = "" if ! defined $note ;
    if ($note) {
        $note = "# $note" if $note !~ /^\s*#/ ;
        $note =~ s/^\s*/ / ;
    }

    print "not " if !$result ;
    print "ok ${number}${note}\n";
}

$Inc = '' ;
foreach (@INC)
 { $Inc .= "-I$_ " }

$Perl = '' ;
$Perl = ($ENV{'FULLPERL'} or $^X or 'perl') ;

$Perl = "$Perl -w" ;

1;