in reply to (OT) Not copy the file
See ExtUtils::Install, which can copy (or prepare to copy) files that are in use. The documentation also tells you how to find out whether you must reboot before the copying takes place.