---
name: "Zim::Utils"
section: "3pm"
platform: "linux"
package: "zim"
version: "0.25-1"
release: "Debian 5.0 (Lenny)"
platforms: ["linux"]
url: "https://new.carta.tech/Zim::Utils"
---

# Zim::Utils(3pm)

Some useful functions and objects for zim.

## NAME

Zim::Utils - Some useful functions and objects for zim.

## DESCRIPTION

This package contains various utilities needed by the zim modules.

## EXPORT

By default the methods `"__()"`, `"__actions()"`, `"file()"`, `"dir()"` and `"buffer()"` are exported.

## METHODS

- "file(@PATH)"

  Returns a new `"Zim::FS::File"` object.

- "dir(@PATH)"

  Returns a new `"Zim::FS::Dir"` object.

- "uri(@URI)"

  Returns a new `"Zim::FS::URI"` object.

- "buffer(\\$STRING)"

  - "buffer(@STRING)"

  Returns a new `"Zim::FS::Buffer"` object.

- "find\_translation()"

  Tries to load messages for the current locale.

- "\_\_(STRING, PARAM =" VALUE, ...)\>

  Return a translation for STRING. Parameters can be placed in the string using `"{PARAM}"` syntax.

- "\_\_actions(BLOCK)"

  Wrapper for `"__()"` that can be used to translate actions.

- "parse\_date(STRING)"

  Parses various date strings and returns a list of year, month and day. If the year is missing a reasonable guess is given. Similar for the century.

  Supported formats:

  ```
          dd/mm           d/mm d/m dd/m
          dd/mm/yy        ...
          dd/mm/yyyy      ...
          yyyy_mm_dd      yy_m_d ...
          yyyy mm dd      yy m d ...
          yyyy:mm:dd      yy:m:d ...
  ```

  TODO: Add other common date formats ?

- "parse\_date\_l(STRING)"

  Like `"parse_date()"` but returns a list similar to `"localtime()"`. If STRING is an integer it calls `"localtime()"` directly.

- "run(PROGRAM, ARG, ...)"

  Run background process (fork + exec).

- "strftime(FMT, @TIME)"

  Wrapper for the "strftime" in POSIX function. Takes care of portability of "%e".

## AUTHOR

Jaap Karssenberg (Pardus) \<pardus@cpan.org\>

Copyright (c) 2007 Jaap G Karssenberg. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

## SEE ALSO
