Writing to a new file first is advisable.

Writing directly to the existing script from the sockread event has big potential to cause issues if the download is corrupted or interrupted. Ideally you should:

1) Write to a separate file first.

2) Perform a validity check to ensure the download wasn't corrupted - ie. calculate a $crc/$md5/$sha1 digest for the new file and compare it with one stored on the server.

3) Optionally create a copy of the old script as a backup.

4) Overwrite the old script with the new one.

5) Perform your /load's.


Spelling mistakes, grammatical errors, and stupid comments are intentional.