I have been working on a Perl script to migrate Branches, Workareas plus last Editions.
It might help to know some more of the particulars (see this) and perhaps the script or at least the iwmigrate command lines used.Also - what do you mean by "migrate Branches, Workareas, plus last Editions"?If you migrate a branch - chances are you already have migrated the last edition.
foreach my $branch (@branches){ # Get latest Branch Edition chomp(my $lasted = qx($iwhome/bin/iwlasted "$branch" 2>&1)); print "\nBranch is: $branch\n"; print "latest Edition: $lasted\n"; # if there are no editions then just migrate branch and workarea my $sarg = ($lasted =~ /^\s*$/) ? "" : qq(-s "$lasted"); executeCmd($branch, qq(iwmigrate -g -m $mount -o "$newStore" -b "$branch" $sarg -d)); executeCmd($branch, qq(iwmigrate -g -m $mount -o "$newStore" -b "$branch" -d -w -only)); }
sub executeCmd{ my($branch1,$cmd) = @_; warn "command is: $cmd\n"; my $result = qx($cmd >> $logdir 2>>$errdir); my $status = $? >> 8; warn "result is [$status]: $result\n";}
Are you collecting the output of iwmigrate ? When it fails, you need to restart it with a different invocation. Most likely you need to run it from a shell to fix.
I don't have time, nor the inclination, to spend too much time trying to figure out / debug your code, but I'll make some suggestions, I suggest you compare this with the code you posted (it's based on that, but significantly cleaner based on what you showed):