Pyrus allows special handling of files through tasks. File tasks can perform any action necessary both when installing a package and when creating a package. Both Pyrus and the PEAR Installer ship with 4 built-in tasks, replace, windowseol, unixeol, and postinstallscript.
Tasks are specifically designed to allow customization of an installation, and particularly modification of a specific file's contents. The unixeol task, for instance, transforms line endings to UNIX \n and is useful for shell scripts that must have the proper line endings. The replace task can be used to update the version of a package directly in the source code, or to automatically set up the path to a PEAR Installation in a shell script.
Tasks are defined using the XML namespace http://pear.php.net/dtd/tasks-1.0. Most often, this is declared using tasks as the namespace prefix, as in xmlns:tasks="http://pear.php.net/dtd/tasks-1.0". More than one task can be used for a single file, as shown by this example from the PEAR package:
<file name="pearcmd.php" role="php"> <tasks:replace from="@php_bin@" to="php_bin" type="pear-config" /> <tasks:replace from="@php_dir@" to="php_dir" type="pear-config" /> <tasks:replace from="@pear_version@" to="version" type="package-info" /> <tasks:replace from="@include_path@" to="php_dir" type="pear-config" /> </file>