1Glib::Utils(3) User Contributed Perl Documentation Glib::Utils(3)
2
3
4
6 Glib::Utils - Miscellaneous utility functions
7
9 use Glib;
10 Glib::set_application_name (Glib::get_real_name."'s Cool Program");
11
12 print "app name is ".Glib::get_application_name()."\n";
13
15 Here are some useful miscellaneous utilities. GLib is a portability
16 library, providing portable utility functions for C programs. As such,
17 most of these functions seem to violate the Glib binding principle of
18 not duplicating functionality that Perl already provides, but there's a
19 distinction for each one, i swear. The functions for dealing with user
20 information are provided on all GLib-supported platforms, not just
21 where POSIX (which provides similar information) is available, and even
22 work on platforms where %ENV may not include the expected information.
23 Also, the "application name" referred to by (set|get)_application_name
24 is a human readable name, distinct from the actual program name
25 provided by Perl's own $0.
26
28 string = Glib::get_application_name
29 Get the human-readable application name set by "set_application_name".
30
31 Since: glib 2.2
32
33 Glib::set_application_name ($application_name)
34 • $application_name (string)
35
36 Set the human-readable application name.
37
38 Since: glib 2.2
39
40 string = Glib::get_home_dir
41 Find the current user's home directory, by system-dependent/appropriate
42 means.
43
44 list = Glib::get_language_names
45 Computes a list of applicable locale names, which can be used to e.g.
46 construct locale-dependent filenames or search paths. The returned list
47 is sorted from most desirable to least desirable and always contains
48 the default locale "C".
49
50 Since: glib 2.6
51
52 string = Glib::get_prgname
53 Glib::set_prgname ($prgname)
54 • $prgname (string)
55
56 string = Glib::get_real_name
57 Get the current user's real name.
58
59 string = Glib::strerror ($err)
60 • $err (integer)
61
62 Return a string describing the given errno value, like "No such file or
63 directory" for ENOENT. This is translated into the user's preferred
64 language and is a utf8 wide-char string (unlike a $! string (perlvar)
65 or POSIX::strerror (POSIX) which are locale codeset bytes).
66
67 string = Glib::strsignal ($signum)
68 • $signum (integer)
69
70 Return a string describing the given signal number, like "Segmentation
71 violation" for SIGSEGV. This is translated into the user's preferred
72 language and is a utf8 wide-char string.
73
74 list = Glib::get_system_config_dirs
75 Returns an ordered list of base directories in which to access system-
76 wide configuration information.
77
78 Since: glib 2.6
79
80 list = Glib::get_system_data_dirs
81 Returns an ordered list of base directories in which to access system-
82 wide application data.
83
84 Since: glib 2.6
85
86 string = Glib::get_tmp_dir
87 Get the temp dir as appropriate for the current system. See the GLib
88 docs for info on how it works.
89
90 string = Glib::get_user_cache_dir
91 Gets the base directory in which to store non-essential, cached data
92 specific to particular user.
93
94 Since: glib 2.6
95
96 string = Glib::get_user_config_dir
97 Gets the base directory in which to store user-specific application
98 configuration information such as user preferences and settings.
99
100 Since: glib 2.6
101
102 string = Glib::get_user_data_dir
103 Get the base directory for application data such as icons that is
104 customized for a particular user.
105
106 Since: glib 2.6
107
108 string = Glib::get_user_name
109 Get the current user's name by whatever system-dependent means
110 necessary.
111
112 string = Glib::get_user_special_dir ($directory)
113 • $directory (Glib::UserDirectory)
114
115 Returns the full path of a special directory using its logical id.
116
117 Since: glib 2.14
118
120 enum Glib::UserDirectory
121 • 'desktop' / 'G_USER_DIRECTORY_DESKTOP'
122
123 • 'documents' / 'G_USER_DIRECTORY_DOCUMENTS'
124
125 • 'download' / 'G_USER_DIRECTORY_DOWNLOAD'
126
127 • 'music' / 'G_USER_DIRECTORY_MUSIC'
128
129 • 'pictures' / 'G_USER_DIRECTORY_PICTURES'
130
131 • 'public-share' / 'G_USER_DIRECTORY_PUBLIC_SHARE'
132
133 • 'templates' / 'G_USER_DIRECTORY_TEMPLATES'
134
135 • 'videos' / 'G_USER_DIRECTORY_VIDEOS'
136
138 Glib
139
141 Copyright (C) 2003-2011 by the gtk2-perl team.
142
143 This software is licensed under the LGPL. See Glib for a full notice.
144
145
146
147perl v5.34.0 2022-01-21 Glib::Utils(3)