1docs::api::Apache2::UtiUls(e3r)Contributed Perl Documentdaotciso:n:api::Apache2::Util(3)
2
3
4
6 Apache2::Util - Perl API for Misc Apache Utility functions
7
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
19 Various Apache utilities that don't fit into any other group.
20
22 "Apache2::Util" provides the following functions and/or methods:
23
24 "escape_path"
25
26 convert an OS path to a URL in an OS dependant way.
27
28 $escaped_path = Apache2::Util::escape_path($path, $p);
29 $escaped_path = Apache2::Util::escape_path($path, $p, $partial);
30
31 arg1: $path ( string )
32 The path to convert
33
34 arg2: $p ( "APR::Pool" )
35 The pool to allocate from
36
37 opt arg3: $partial ( boolean )
38 if TRUE, assume that the path will be appended to something with a
39 '/' in it (and thus does not prefix "./")
40
41 if FALSE it prepends "./" unless $path contains ":" optionally fol‐
42 lowed by "/".
43
44 the default is TRUE
45
46 ret: $escaped_path ( string )
47 The escaped path
48
49 since: 2.0.00
50
51 "ht_time"
52
53 Convert time from an integer value into a string in a specified format
54
55 $time_str = Apache2::Util::ht_time($p);
56 $time_str = Apache2::Util::ht_time($p, $time);
57 $time_str = Apache2::Util::ht_time($p, $time, $fmt);
58 $time_str = Apache2::Util::ht_time($p, $time, $fmt, $gmt);
59
60 arg1: $p ( "APR::Pool object" )
61 The pool to allocate memory from
62
63 opt arg2: $time ( number )
64 The time to convert (e.g., "time()" or "$r->request_time").
65
66 If the value is not passed the current time will be used.
67
68 opt arg3: $fmt ( string )
69 The format to use for the conversion, using strftime(3) tokens.
70
71 If the value is not passed the default format used is:
72
73 "%a, %d %b %Y %H:%M:%S %Z"
74
75 opt arg4: $gmt ( boolean )
76 The time will be not converted to GMT if FALSE is passed.
77
78 If the value is not passed TRUE (do convert) is used as a default.
79
80 ret: $time_str (string)
81 The string that represents the specified time
82
83 since: 2.0.00
84
85 Examples:
86
87 Use current time, the default format and convert to GMT:
88
89 $fmtdate = Apache2::Util::ht_time($r->pool);
90
91 Use my time, the default format and convert to GMT:
92
93 my $time = time+100;
94 $fmtdate = Apache2::Util::ht_time($r->pool, $time);
95
96 Use the time the request has started, custom format and don't convert
97 to GMT:
98
99 my $fmt = "%a, %D %H:%M:%S %Z";
100 $fmtdate = Apache2::Util::ht_time($r->pool, $r->request_time, $fmt, 0);
101
103 mod_perl 2.0 documentation.
104
106 mod_perl 2.0 and its core modules are copyrighted under The Apache
107 Software License, Version 2.0.
108
110 The mod_perl development team and numerous contributors.
111
112
113
114perl v5.8.8 2006-11-19 docs::api::Apache2::Util(3)