These were my working assumptions:
1) The spool directory is primarily an application feature, so the spool_dir() sub belongs in Qpsmtpd.pm itself.
2) It behooves us to similarly centralize the creation of temporary filenames (and by extension, of temporary directories), so these two subs also live in Qpsmtpd.pm itself.
3) The appropriate lifetime of temp files and directories, from the plugin's standpoint, is the Transaction, not the Connection; hence I added shortcuts in Q::Plugins to create the temporary files and dirs, and registered those names with the current Transaction object. Then when the DESTROY is called for the transaction, those files and directories are automatically deleted.
In reference to #3, it could be argued that there may be utility to having the temp files expire at the end of the Connection, but it seems less likely to be useful. In any case, a plugin is free to call the base class temp_file() sub and handle the delete as it sees fit.
The other thing that could be done is to make the return of temp_file be a subclass of IO::File, so a single hash entry could be both the filename and the filehandle, but it isn't such a big deal to open the file (and there may be plenty of times when you want to hand the filename to an external program to fill, rather than using it internally).
Should I commit this???
John
--- Begin Message ---A file for you
spooldir.patch
Description: Binary data
--- End Message ---
