This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate CPAN release of version.pm 0.9905
[perl5.git] / cpan / Filter-Util-Call / filter-util.pl
CommitLineData
4176d4e4
JH
1
2use strict ;
3use warnings;
4
5use vars qw( $Perl $Inc);
6
2c4bb738
JH
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 }
d1e4d418 28 close F or die "Could not close: $!" ;
2c4bb738
JH
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)
03ec374d 47 { $Inc .= "\"-I$_\" " }
e69a2255 48$Inc = "-I::lib" if $^O eq 'MacOS';
2c4bb738
JH
49
50$Perl = '' ;
51$Perl = ($ENV{'FULLPERL'} or $^X or 'perl') ;
52
0fed2c4d 53$Perl = "$Perl -MMac::err=unix" if $^O eq 'MacOS';
2c4bb738
JH
54$Perl = "$Perl -w" ;
55
561;