---
name: "Glib::Utils"
section: "3pm"
platform: "linux"
package: "glib-perl"
version: "1.329.4-4"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/Glib::Utils"
---

# Glib::Utils(3pm)

Miscellaneous utility functions

## NAME

Glib::Utils -  Miscellaneous utility functions

## SYNOPSIS

```
  use Glib;
  Glib::set_application_name (Glib::get_real_name."'s Cool Program");
  print "app name is ".Glib::get_application_name()."\n";
```

## DESCRIPTION

Here are some useful miscellaneous utilities. GLib is a portability library, providing portable utility functions for C programs.  As such, most of these functions seem to violate the Glib binding principle of not duplicating functionality that Perl already provides, but there's a distinction for each one, i swear.  The functions for dealing with user information are provided on all GLib-supported platforms, not just where POSIX (which provides similar information) is available, and even work on platforms where `%ENV` may not include the expected information.  Also, the "application name" referred to by (set\|get)\_application\_name is a human readable name, distinct from the actual program name provided by Perl's own `$0`.

## METHODS

### string = Glib::get\_application\_name

Get the human-readable application name set by `"set_application_name"`.

Since: glib 2.2

### Glib::set\_application\_name ($application\_name)

- •

  `$application_name` (string)

Set the human-readable application name.

Since: glib 2.2

### string = Glib::get\_home\_dir

Find the current user's home directory, by system-dependent/appropriate means.

### list = Glib::get\_language\_names

Computes a list of applicable locale names, which can be used to e.g. construct locale-dependent filenames or search paths. The returned list is sorted from most desirable to least desirable and always contains the default locale "C".

Since: glib 2.6

### string = Glib::get\_prgname

### Glib::set\_prgname ($prgname)

- •

  `$prgname` (string)

### string = Glib::get\_real\_name

Get the current user's real name.

### string = Glib::strerror ($err)

- •

  `$err` (integer)

Return a string describing the given errno value, like "No such file or directory" for ENOENT.  This is translated into the user's preferred language and is a utf8 wide-char string (unlike a $! string (perlvar) or POSIX::strerror (POSIX) which are locale codeset bytes).

### string = Glib::strsignal ($signum)

- •

  `$signum` (integer)

Return a string describing the given signal number, like "Segmentation violation" for SIGSEGV.  This is translated into the user's preferred language and is a utf8 wide-char string.

### list = Glib::get\_system\_config\_dirs

Returns an ordered list of base directories in which to access system-wide configuration information.

Since: glib 2.6

### list = Glib::get\_system\_data\_dirs

Returns an ordered list of base directories in which to access system-wide application data.

Since: glib 2.6

### string = Glib::get\_tmp\_dir

Get the temp dir as appropriate for the current system.  See the GLib docs for info on how it works.

### string = Glib::get\_user\_cache\_dir

Gets the base directory in which to store non-essential, cached data specific to particular user.

Since: glib 2.6

### string = Glib::get\_user\_config\_dir

Gets the base directory in which to store user-specific application configuration information such as user preferences and settings.

Since: glib 2.6

### string = Glib::get\_user\_data\_dir

Get the base directory for application data such as icons that is customized for a particular user.

Since: glib 2.6

### string = Glib::get\_user\_name

Get the current user's name by whatever system-dependent means necessary.

### string = Glib::get\_user\_special\_dir ($directory)

- •

  `$directory` (Glib::UserDirectory)

Returns the full path of a special directory using its logical id.

Since: glib 2.14

## ENUMS AND FLAGS

### enum Glib::UserDirectory

- •

  'desktop' / 'G\_USER\_DIRECTORY\_DESKTOP'

- •

  'documents' / 'G\_USER\_DIRECTORY\_DOCUMENTS'

- •

  'download' / 'G\_USER\_DIRECTORY\_DOWNLOAD'

- •

  'music' / 'G\_USER\_DIRECTORY\_MUSIC'

- •

  'pictures' / 'G\_USER\_DIRECTORY\_PICTURES'

- •

  'public-share' / 'G\_USER\_DIRECTORY\_PUBLIC\_SHARE'

- •

  'templates' / 'G\_USER\_DIRECTORY\_TEMPLATES'

- •

  'videos' / 'G\_USER\_DIRECTORY\_VIDEOS'

## SEE ALSO

Glib

## COPYRIGHT

Copyright (C) 2003-2011 by the gtk2-perl team.

This software is licensed under the LGPL.  See Glib for a full notice.
