This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update Filter::Util::Call to CPAN version 1.58
[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
356231b0
SH
12 open (F, "<", $filename)
13 or die "Cannot read $filename: $!\n" ;
2c4bb738
JH
14 while (<F>)
15 { $string .= $_ }
16 close F ;
17 $string ;
18}
19
20sub writeFile
21{
22 my($filename, @strings) = @_ ;
356231b0
SH
23 open (F, ">", $filename)
24 or die "Cannot write $filename: $!\n" ;
2c4bb738
JH
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{
0168e427 33 my ($number, $result, $note) = @_ ;
2c4bb738
JH
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";
0168e427
CBW
43 return $result;
44}
45
46sub diag {
47 print STDERR
48 (map { /^#/ ? "$_\n" : "# $_\n" }
49 map { split /\n/ } @_);
2c4bb738
JH
50}
51
52$Inc = '' ;
0168e427 53foreach (@INC) { $Inc .= "\"-I$_\" " }
e69a2255 54$Inc = "-I::lib" if $^O eq 'MacOS';
2c4bb738
JH
55
56$Perl = '' ;
57$Perl = ($ENV{'FULLPERL'} or $^X or 'perl') ;
58
0fed2c4d 59$Perl = "$Perl -MMac::err=unix" if $^O eq 'MacOS';
2c4bb738
JH
60$Perl = "$Perl -w" ;
61
621;