Skip to main content


First things first, I am a data engineer but have little experience in Perl. I've been able to make some easy updates to scripts in the past but this one is a bit tougher.

I have been asked to update a Perl cgi web app that someone wrote ages ago that is used to view and manipulate text files. Currently it is hosted on server (X) and manipulates the files on that same server. However, we have to have backups/mirrors of the data on a dev server and another prod sever (Y). I.e., if I push the button to move the file to a different folder, it should do that on all three servers instead of just X. I added code to do this, referencing the additional servers with their UNC names, but I just get an error "No such file or directory" (which is not true). Googling has suggested that there may be an issue with permissions, but I can bring up the Y and DEV servers from a windows file explorer using the same path so I don't think that is necessarily the issue.

Example: Here we are trying to copy the file with a letter appended a given number of times. It works fine on the X server, its when trying to make it also work on the Y and DEV servers I get an error.

our $DIR_X = "\\\\serverX\\folder\\subfolder" ; our $DIR_Y = "\\\\serverY\\folder\\subfolder"; our $DIR_DEV = "\\\\serverDEV\\folder\\subfolder"; . . . }elsif ($query->param('action') eq 'split' && $query->param('fileNum') ne "") { my $fileNum $query->param('fileNum'); my $fileX=$DIR_X . "\\" . $fileNum . ".txt"; my $fileY $DIR_Y . "\\" . $fileNum . ".txt"; my $fileDEV = $DIR_DEV . "\\" . $fileNum . ".txt"; my $splitNbr = $query->param('splitNbr'); my @letters1("a".. "z"); for (my $i = 0; $i < $splitNbr; $i++) { my $FileNew_X = $DIR_X . "\\" $fileNum. $letters[$i]=.txt"; my $FileNew_Y = $DIR_Y . "\\" $fileNum. $letters[$i]=.txt"; my $FileNew_DEV = $DIR_DEV . "\\" $fileNum. $letters[$i]=.txt"; copy($fileX, $FileNew_X) or die "WARNING: copy failed: $!\n"; ---->>>>>ERROR AT NEXT LINE copy($fileY, $FileNew_Y) or die "WARNING: copy failed: $!\n"; copy($fileDEV, $FileNew_DEV) or die "WARNING: copy failed: $!\n"; } 

Any thoughts?

submitted by /u/QueenScorp
[link] [comments]