Dennis Daupert wrote: > Still having the same error capture problems tho. > When I un-share the remote directory, run the > script, here's what get's written to my log (I'm > particularly unnerved by the msg "The operation > completed successfully"): > > [2006-10-04 04:53:08] Try to copy file testfile3.txt > [2006-10-04 04:53:08] FROM: data\testfile3.txt > [2006-10-04 04:53:08] TO: \\xx.xx.xx.xx\data\testfile3.txt > [2006-10-04 04:53:12] No eval error > [2006-10-04 04:53:12] return:
I would take the above to mean an error occurred. > [2006-10-04 04:53:12] err_msg: The operation completed successfully. > [2006-10-04 04:53:12] No ^E error > > Here are the relevant lines of code: > > eval { > $return = CopyEx "$copy_from" => "$copy_to", FOF_NOERRORUI | FOF_SILENT; > }; > > if ( $@ ) { > $logger->info("ERROR: $@"); > } > else { > $logger->info("No eval error"); > } > > $logger->info("return: $return"); The fact that you failed to get a true return should have caused you concern here - it should return the number of successful copies or an undef if any copies failed (not the best solution for a multi-copy call - stick to single copies for clarity). The API call return isn't saved - apparently GetLastError doesn't get trap error. SHFileOperation returns a zero on success, but doesn't indicate much about the error handling when something goes wrong. If you get a false/undef return from the CopyEx - that's an error and you should indicate so even if you can't figure out what the error text/number actually is. > my $err_msg = Win32::FormatMessage(Win32::GetLastError()); > > if ( $err_msg ) { > $logger->info("err_msg: $err_msg"); > } > else { > $logger->info("No $err_msg"); > } > > if ( $^E ) { > $logger->info("^E ERROR: $^E"); > } > else { > $logger->info("No ^E error"); > } > _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs