1docs::api::Apache2::UtiUls(e3r)Contributed Perl Documentdaotciso:n:api::Apache2::Util(3)
2
3
4

NAME

6       Apache2::Util - Perl API for Misc Apache Utility functions
7

Synopsis

9         use Apache2::Util ();
10
11         # OS escape path
12         $escaped_path = Apache2::Util::escape_path($path, "a 'long' file.html");
13
14         # format time as a string
15         my $fmt = "%a, %D %H:%M:%S %Z";
16         $fmtdate = Apache2::Util::ht_time($r->pool, $r->request_time, $fmt, 0);
17

Description

19       Various Apache utilities that don't fit into any other group.
20

Functions API

22       "Apache2::Util" provides the following functions and/or methods:
23
24   "escape_path"
25       convert an OS path to a URL in an OS dependant way.
26
27         $escaped_path = Apache2::Util::escape_path($path, $p);
28         $escaped_path = Apache2::Util::escape_path($path, $p, $partial);
29
30       arg1: $path ( string )
31           The path to convert
32
33       arg2: $p ( "APR::Pool" )
34           The pool to allocate from
35
36       opt arg3: $partial ( boolean )
37           if TRUE, assume that the path will be appended to something with a
38           '/' in it (and thus does not prefix "./")
39
40           if FALSE it prepends "./" unless $path contains ":" optionally
41           followed by "/".
42
43           the default is TRUE
44
45       ret: $escaped_path ( string )
46           The escaped path
47
48       since: 2.0.00
49
50   "ht_time"
51       Convert time from an integer value into a string in a specified format
52
53         $time_str = Apache2::Util::ht_time($p);
54         $time_str = Apache2::Util::ht_time($p, $time);
55         $time_str = Apache2::Util::ht_time($p, $time, $fmt);
56         $time_str = Apache2::Util::ht_time($p, $time, $fmt, $gmt);
57
58       arg1: $p ( "APR::Pool object" )
59           The pool to allocate memory from
60
61       opt arg2: $time ( number )
62           The time to convert (e.g., "time()" or "$r->request_time").
63
64           If the value is not passed the current time will be used.
65
66       opt arg3: $fmt ( string )
67           The format to use for the conversion, using strftime(3) tokens.
68
69           If the value is not passed the default format used is:
70
71             "%a, %d %b %Y %H:%M:%S %Z"
72
73       opt arg4: $gmt ( boolean )
74           The time will be not converted to GMT if FALSE is passed.
75
76           If the value is not passed TRUE (do convert) is used as a default.
77
78       ret: $time_str (string)
79           The string that represents the specified time
80
81       since: 2.0.00
82
83       Examples:
84
85       Use current time, the default format and convert to GMT:
86
87         $fmtdate = Apache2::Util::ht_time($r->pool);
88
89       Use my time, the default format and convert to GMT:
90
91         my $time = time+100;
92         $fmtdate = Apache2::Util::ht_time($r->pool, $time);
93
94       Use the time the request has started, custom format and don't convert
95       to GMT:
96
97         my $fmt = "%a, %D %H:%M:%S %Z";
98         $fmtdate = Apache2::Util::ht_time($r->pool, $r->request_time, $fmt, 0);
99

See Also

101       mod_perl 2.0 documentation.
102
104       mod_perl 2.0 and its core modules are copyrighted under The Apache
105       Software License, Version 2.0.
106

Authors

108       The mod_perl development team and numerous contributors.
109
110
111
112perl v5.30.1                      2020-01-29       docs::api::Apache2::Util(3)
Impressum