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_real_name
53 Get the current user's real name.
54
55 string = Glib::strerror ($err)
56 · $err (integer)
57
58 Return a string describing the given errno value, like "No such file or
59 directory" for ENOENT. This is translated into the user's preferred
60 language and is a utf8 wide-char string (unlike a $! string (perlvar)
61 or POSIX::strerror (POSIX) which are locale codeset bytes).
62
63 string = Glib::strsignal ($signum)
64 · $signum (integer)
65
66 Return a string describing the given signal number, like "Segmentation
67 violation" for SIGSEGV. This is translated into the user's preferred
68 language and is a utf8 wide-char string.
69
70 list = Glib::get_system_config_dirs
71 Returns an ordered list of base directories in which to access system-
72 wide configuration information.
73
74 Since: glib 2.6
75
76 list = Glib::get_system_data_dirs
77 Returns an ordered list of base directories in which to access system-
78 wide application data.
79
80 Since: glib 2.6
81
82 string = Glib::get_tmp_dir
83 Get the temp dir as appropriate for the current system. See the GLib
84 docs for info on how it works.
85
86 string = Glib::get_user_cache_dir
87 Gets the base directory in which to store non-essential, cached data
88 specific to particular user.
89
90 Since: glib 2.6
91
92 string = Glib::get_user_config_dir
93 Gets the base directory in which to store user-specific application
94 configuration information such as user preferences and settings.
95
96 Since: glib 2.6
97
98 string = Glib::get_user_data_dir
99 Get the base directory for application data such as icons that is
100 customized for a particular user.
101
102 Since: glib 2.6
103
104 string = Glib::get_user_name
105 Get the current user's name by whatever system-dependent means
106 necessary.
107
108 string = Glib::get_user_special_dir ($directory)
109 · $directory (Glib::UserDirectory)
110
111 Returns the full path of a special directory using its logical id.
112
113 Since: glib 2.14
114
116 enum Glib::UserDirectory
117 · 'desktop' / 'G_USER_DIRECTORY_DESKTOP'
118
119 · 'documents' / 'G_USER_DIRECTORY_DOCUMENTS'
120
121 · 'download' / 'G_USER_DIRECTORY_DOWNLOAD'
122
123 · 'music' / 'G_USER_DIRECTORY_MUSIC'
124
125 · 'pictures' / 'G_USER_DIRECTORY_PICTURES'
126
127 · 'public-share' / 'G_USER_DIRECTORY_PUBLIC_SHARE'
128
129 · 'templates' / 'G_USER_DIRECTORY_TEMPLATES'
130
131 · 'videos' / 'G_USER_DIRECTORY_VIDEOS'
132
134 Glib
135
137 Copyright (C) 2003-2011 by the gtk2-perl team.
138
139 This software is licensed under the LGPL. See Glib for a full notice.
140
141
142
143perl v5.28.1 2019-02-06 Glib::Utils(3)