1Mail::SpamAssassin::UtiUls(e3r)Contributed Perl DocumentMaatiilo:n:SpamAssassin::Util(3)
2
3
4

NAME

6       Mail::SpamAssassin::Util - utility functions
7

DESCRIPTION

9       A general class for utility functions.  Please use this for functions
10       that stand alone, without requiring a $self object, Portability func‐
11       tions especially.
12
13       NOTE: The functions in this module are to be considered private.  Their
14       API may change at any point, and it's expected that they'll only be
15       used by other Mail::SpamAssassin modules. (TODO: we should probably
16       revisit this if it's useful for plugin development.)
17
18       $module = first_available_module (@module_list)
19           Return the name of the first module that can be successfully loaded
20           with "require" from the list.  Returns "undef" if none are avail‐
21           able.
22
23           This is used instead of "AnyDBM_File" as follows:
24
25             my $module = Mail::SpamAssassin::Util::first_available_module
26                                   (qw(DB_File GDBM_File NDBM_File SDBM_File));
27             tie %hash, $module, $path, [... args];
28
29           Note that "SDBM_File" is guaranteed to be present, since it comes
30           with Perl.
31
32       my ($filepath, $filehandle) = secure_tmpfile();
33           Generates a filename for a temporary file, opens it exclusively and
34           securely, and returns a filehandle to the open file (opened
35           O_RDWR).
36
37           If it cannot open a file after 20 tries, it returns "undef".
38
39       my ($dirpath) = secure_tmpdir();
40           Generates a directory for temporary files.  Creates it securely and
41           returns the path to the directory.
42
43           If it cannot create a directory after 20 tries, it returns "undef".
44
45
46
47perl v5.8.8                       2008-01-05       Mail::SpamAssassin::Util(3)
Impressum