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
11       functions 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       NOTE: Utility functions should not be changing global variables such as
19       $_, $1, $2, ... $/, etc. unless explicitly documented.  If these
20       variables are in use by these functions, they should be localized.
21
22       $module = first_available_module (@module_list)
23           Return the name of the first module that can be successfully loaded
24           with "require" from the list.  Returns "undef" if none are
25           available.
26
27           This is used instead of "AnyDBM_File" as follows:
28
29             my $module = Mail::SpamAssassin::Util::first_available_module
30                                   (qw(DB_File GDBM_File NDBM_File SDBM_File));
31             tie %hash, $module, $path, [... args];
32
33           Note that "SDBM_File" is guaranteed to be present, since it comes
34           with Perl.
35
36       touch_file(file, { args });
37           Touch or create a file.
38
39           Possible args:
40
41           create_exclusive => 1
42             Create a new empty file safely, only if not existing before
43
44       my ($filepath, $filehandle) = secure_tmpfile();
45           Generates a filename for a temporary file, opens it exclusively and
46           securely, and returns a filehandle to the open file (opened
47           O_RDWR).
48
49           If it cannot open a file after 20 tries, it returns "undef".
50
51       my ($dirpath) = secure_tmpdir();
52           Generates a directory for temporary files.  Creates it securely and
53           returns the path to the directory.
54
55           If it cannot create a directory after 20 tries, it returns "undef".
56
57
58
59perl v5.32.1                      2021-03-25       Mail::SpamAssassin::Util(3)
Impressum