brucemiller/LaTeXML — pull request #493 by dginev (2014-05-20 18:40:41+00:00)
Title: Better scoped temporary directories

Two main changes:
* Using the object-oriented File::Temp interface, which deletes the temporary files/directories whenever the object goes out of scope.
* I kept ```CLEANUP=>0``` when there was one, to keep your functionality as intended.
* Image::Magick has, in the C codebase, the behaviour to persist some of its temporary files until the entire process dies. It avoids memory use by "shredding" the files, and leaving them with size 0. In the arXiv conversion, that lead to filling up /dev/shm with over 10,000 zero size magick-XXX files, which was troublesome.
* I have added a ```DESTROY``` method for LaTeXImages.pm that makes sure to clean up after Image::Magick, by deleting any zero-size files in the temporary directory used by File::Temp. According to their documentation, they always use ```File::Spec->tmpdir()```.

Please review and comment. Thanks!