3 use vars qw($Is_W32 $Is_OS2 $Is_Cygwin $Is_NetWare $Needs_Write);
4 use Config; # Remember, this is running using an existing perl
6 # Common functions needed by the regen scripts
8 $Is_W32 = $^O eq 'MSWin32';
9 $Is_OS2 = $^O eq 'os2';
10 $Is_Cygwin = $^O eq 'cygwin';
11 $Is_NetWare = $Config{osname} eq 'NetWare';
16 $Needs_Write = $Is_OS2 || $Is_W32 || $Is_Cygwin || $Is_NetWare;
18 eval "use Digest::MD5 'md5'; 1;"
19 or warn "Digest::MD5 unavailable, doing unconditional regen\n";
28 $cksum = defined &md5 ? md5($buf) : 0;
41 foreach $name (@names) {
43 chmod 0777, $name if $Needs_Write;
44 ( CORE::unlink($name) and ++$cnt
45 or warn "Couldn't unlink $name: $!\n" );
50 sub safer_rename_silent {
53 # Some dosish systems can't rename over an existing file:
55 chmod 0600, $from if $Needs_Write;
59 sub safer_rename_always {
61 safer_rename_silent($from, $to) or die "renaming $from to $to: $!";
67 my $fc = cksum($from);
70 if ($fc and $fc eq $tc) {
71 warn "no changes between '$from' & '$to'\n";
75 warn "changed '$from' to '$to'\n";
76 safer_rename_silent($from, $to) or die "renaming $from to $to: $!";