Know-How für Ihr Projekt

Perl Documentation


dir_to_xml - Convert a directory request to XML


Plugin dir_to_xml
# optional
DirExternalEncoding iso-8859-1


This module turns a directory request into XML so that other plugins can process the directory in the same way as other XML inputs.


The following is an example of the XML format to expect from this plugin:

<?xml version="1.0" encoding="UTF-8"?>
<filelist xmlns="">
  <directory size="4096" atime="1077320634" mtime="1077312841" ctime="1077312841" readable="1" executable="1" url=".">.</directory>
  <directory size="4096" atime="1077316522" mtime="1076743711" ctime="1076743711" readable="1" executable="1" url=".">..</directory>
  <file size="0" atime="1076770889" mtime="1076770889" ctime="1076770889" readable="1" url="index.xml">index.xml</file>
  <directory size="4096" atime="1076954718" mtime="1076774280" ctime="1076774280" readable="1" executable="1" url="images">images</directory>
  <file size="580626" atime="1077319951" mtime="1076774007" ctime="1076774007" readable="1" url="link-4.1a.tar.gz">link-4.1a.tar.gz</file>
  <file size="708" atime="1077319951" mtime="1076774018" ctime="1076774018" readable="1" executable="1" url=""></file>

The url attribute may seem superfluous, but it allows to unify XML-processing (which is unicode all the way) and legacy encodings. Use the tag text for displaying file names, and url for hyperlinks, and your app will transparently support file names that are not UTF-8 encoded.


You can call the plugin as standalone perl script as well, it takes a single parameter (the directory to print) and prints out the corresponding XML document on STDOUT. If your XSLT (or any other) stylesheets are designed to run standalone as well, then this allows you to simulate your website offline.


None, but see AxKit2::Utils::ustr, as this plugin uses it for processing file names.