<lots of rude words of frustration!>
It's NOT working. The example I had working was doing it running standalone but the production version has to run as a task called under another app. The code below never gets away from the application's run time directory even though they're both branches under the same root.
$vsvroot = $config{$ServerX . "ROOT"};
chdir($vsvroot);
MsgLog ("d", "vsvroot = $vsvroot");
MsgLog ("d", cwd());
foreach $vsvxdb (<cntl/*>) {
MsgLog ("d", "Add $vsvxdb to tarfile\n");
if (! $tar->add_files($vsvxdb)) {
MsgLog ("e", "Failed to add original $vsvxdb to backup
+ archive. Quitting.")
}
}
The log shows...
vsvroot = "C:\LRSROOT\vsvxroot"
C:/LRSROOT/vpsxroot
Add cntl/ckpt.dat to tarfile
Which lines above correspond to the three MsgLog function calls in the sample code. Note that the vsvroot variable (I left the $ off in the log message) uses backslashes and points to the vsVxroot folder but the print of cwd() shows the vPsxroot folder - same parent, different subfolders. The perl code is called from and app who's root is vPsxroot.
I've tried this with a simple test script and it definitely still calls tar from the working directory which is not changed by chdir(). I'm very confused! |