scain has asked for the wisdom of the Perl Monks concerning the following question:

Hello Fine Monks,

In an effort to make my webapp install cross-platform, I have written several small Perl scripts that do some of the moving of files for 'make install'. These scripts work fine when installing on a Linux box, and they work when installing on a Win2k box, as long as the files that it is trying to install don't already exist in the install location. If the files are alread there, the script dies thusly:

conf\plugins\ unable to copy to C:\progra~1\apache~1\apa +che\conf\gbrowse.conf\plugins\ : Bad file descriptor NMAKE : fatal error U1077: 'C:\WINNT\system32\cmd.exe' : return code ' +0x9' Stop.
Now, I suppose I could check for the existence of the file, unlink it and then copy it, but that seems quite ugly to me, when File::Copy's copy should work just fine. Any suggestions? The code follows:
#!/usr/bin/perl -w use strict; #Perform installation of gbrowse apache configuration files use File::Copy; use Bio::Root::IO; # get configuration stuff from command line my $dir = $ARGV[0]; # use Bio::Root::IO now #my $delim = '/'; #if ($Config{'osname'} =~ /win/i && $Config{'osname'} !~ /darwin/i ) { # $dir =~ s!\/!\\!g; # $delim = '\\'; #} #start the installation... print "Installing sample configuration files...\n"; if (! (-e $dir)) { mkdir($dir,0777) or die "unable to make $dir directory\n"; } opendir CONFDIR, "conf" or die "unable to opendir conf\n"; while (my $conffile = readdir(CONFDIR) ) { my $localfile = Bio::Root::IO->catfile('conf', $conffile); if (-f $localfile) { my $installfile = Bio::Root::IO->catfile($dir, $conffile); if (-f $installfile) { print " Found $conffile in $dir. Skipping...\n"; } else { copy($localfile, $installfile) or die "unable to copy to $installfile\n"; } } } closedir CONFDIR; my $plugindir = Bio::Root::IO->catfile($dir, "plugins"); if (! (-e $plugindir)) { mkdir($plugindir,0777) or die "unable to mkdir $plugindir\n"; } opendir PLUGINS, "conf/plugins" or die "unable to opendir ./conf/plugi +ns\n"; while (my $pluginfile = readdir(PLUGINS) ) { my $localfile = Bio::Root::IO->catfile('conf/plugins',$pluginfile) +; if (-f $localfile) { my $installfile = Bio::Root::IO->catfile($plugindir, $pluginfi +le); copy($localfile, $installfile) or die "unable to copy to $installfile\n"; } } closedir PLUGINS; my $langdir = Bio::Root::IO->catfile($dir, 'languages'); if (! (-e $langdir)) { mkdir($langdir,0777) or die "unable to mkdir $langdir\n"; } opendir LANGS, "conf/languages" or die "unable to opendir ./conf/langu +ages\n"; while (my $langfile = readdir(LANGS)) { my $localfile = Bio::Root::IO->catfile("conf/languages", $langfile +); if (-f $localfile) { my $installfile = Bio::Root::IO->catfile($langdir, $langfile); copy($localfile, $installfile) or die "unable to copy to $installfile\n"; } } closedir LANGS;

Project coordinator of the Generic Model Organism Database Project