Zim::Utils.3pm

Langue: en

Version: 2009-03-16 (fedora - 05/07/09)

Section: 3 (Bibliothèques de fonctions)

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, see Zim::FS.
"dir(@PATH)"
Returns a new "Zim::FS::Dir" object, see Zim::FS.
"uri(@URI)"
Returns a new "Zim::FS::URI" object, see Zim::FS.
"buffer(\$STRING)"
"buffer(@STRING)"
Returns a new "Zim::FS::Buffer" object, see Zim::FS.
"find_translation()"
Tries to load messages for the current locale. Called automatically when this module is loaded.
"__(STRING, PARAM => VALUE, ...)"
Return a translation for STRING. Parameters can be placed in the string using "{PARAM}" syntax.
"__n(STRING, PLURAL_STRING, number => N, PARAM => VALUE, ...)"
Like "__()" but deals with plural forms. The parameter "{number}" determines which plural is used (yes translations can have more than one plural form ...).
"__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