Module pepper.utils

Miscellaneous utility functions

Functions

basename (path) Returns the non-directory portion of a pathname.
dirname (path) Returns the directory portion of a pathname.
mkstemp (template) Opens a unique temporary file.
split (string, pattern) Splits the given string.
strptime (s, format) Wrapper for strptime(3).
unlink (path, recurse) Removes a file or directory.


Functions

basename (path)
Returns the non-directory portion of a pathname. This function acts like basename(1), but doesn't strip suffixes.

Parameters

  • path:
dirname (path)
Returns the directory portion of a pathname. This function acts like dirname(1), i.e. it also returns a dot if the given path contains no slash.

Parameters

  • path:
mkstemp (template)
Opens a unique temporary file.

Parameters

  • template: An optional filename template

Return value:

A pair containing the file handle and the file name
split (string, pattern)
Splits the given string.

Parameters

  • string: The string
  • pattern: A pattern specifying the split points (not a regular expression)
strptime (s, format)
Wrapper for strptime(3). The C function strprime(3) can parse string representations of time. The time format will be passed directly to strptime(3), so you can check the corresponding man page for a possible field specifiers.

Parameters

  • s: String describing a time
  • format: Time format

Return value:

A UNIX timestamp
unlink (path, recurse)
Removes a file or directory.

Parameters

  • path: The path to the file
  • recurse: Recurse into subdirectories (default is false)

Valid XHTML 1.0!