I'm trying to build a quick auto-updater in Perl Windows. I've noticed that when I call cpanp to install the update of the package it fails to install a new version of the script because the script is currently running. I'm calling cpanp with CORE::system() currently. If I called cpanp with exec() would that release the executable for replacement? Or, does Windows keep it tied up even though execution has been turned over entirely to cpanp?

Currently, my process flow looks something like this,

  1. Download META.yml from server
  2. Parse out the version of META.yml
  3. Compare against the current $VERSION
    • If the current version is lower, generate a version string using the data in META.yml
      1. Generate a URL to package using the host/path fo META.yml and the version/data information
      2. Inform user of update
      3. Spawn cpanp to run update with URL.
    • If the current version is the same
      1. Do nothing

Would system() behave differently than exec() on Win32 with regard to replacement of the executable? On Linux it works as designed.

Edit
Report