File::Temp->newdir() ensures temporary directory is deleted as soon as it goes out of scope, instead of persisting until script exit. Important as archiving can create large numbers of temporary directories.
Use the system tempdir (typically /tmp) to avoid cluttering up the working directory
The sigtrap pragma ensures object destructors are called (thereby removing temp directories), even after Control-C or similar.