mod_perl logo perl icon
previous page: Apache2::URI - Perl API for manipulating URIspage up: mod_perl 2.0 APInext page: APR - Perl Interface for Apache Portable Runtime (libapr and
libaprutil Libraries)

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






The mod_perl Developer's Cookbook

The mod_perl Developer's Cookbook

By Geoffrey Young, Paul Lindner, Randy Kobes
mod_perl Pocket Reference

mod_perl Pocket Reference

By Andrew Ford
Writing Apache Modules with Perl and C

Writing Apache Modules with Perl and C

By Lincoln Stein, Doug MacEachern
Embedding Perl in HTML with Mason

Embedding Perl in HTML with Mason

By Dave Rolsky, Ken Williams
mod_perl2 User's Guide

mod_perl2 User's Guide

By Stas Bekman, Jim Brandt
Practical mod_perl

Practical mod_perl

By Stas Bekman, Eric Cholet


Table of Contents

Synopsis

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


TOP

Description

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



TOP

Functions API

Apache2::Util provides the following functions and/or methods:



TOP

escape_path

convert an OS path to a URL in an OS dependant way.

  $escaped_path = Apache2::Util::escape_path($path, $p);
  $escaped_path = Apache2::Util::escape_path($path, $p, $partial);


TOP

ht_time

Convert time from an integer value into a string in a specified format

  $time_str = Apache2::Util::ht_time($p);
  $time_str = Apache2::Util::ht_time($p, $time);
  $time_str = Apache2::Util::ht_time($p, $time, $fmt);
  $time_str = Apache2::Util::ht_time($p, $time, $fmt, $gmt);

Examples:

Use current time, the default format and convert to GMT:

  $fmtdate = Apache2::Util::ht_time($r->pool);

Use my time, the default format and convert to GMT:

  my $time = time+100;
  $fmtdate = Apache2::Util::ht_time($r->pool, $time);

Use the time the request has started, custom format and don't convert to GMT:

  my $fmt = "%a, %D %H:%M:%S %Z";
  $fmtdate = Apache2::Util::ht_time($r->pool, $r->request_time, $fmt, 0);


TOP

See Also

mod_perl 2.0 documentation.



TOP

Copyright

mod_perl 2.0 and its core modules are copyrighted under The Apache Software License, Version 2.0.



TOP

Authors

The mod_perl development team and numerous contributors.






TOP
previous page: Apache2::URI - Perl API for manipulating URIspage up: mod_perl 2.0 APInext page: APR - Perl Interface for Apache Portable Runtime (libapr and
libaprutil Libraries)