1Glib::IO(3) User Contributed Perl Documentation Glib::IO(3)
2
3
4
6 Glib::IO - Perl bindings to the GIO library
7
9 use Glib;
10 use Glib::IO;
11
12 # Synchronous I/O
13 $cur_dir = Glib::IO::File::new_for_path('.');
14 $enumerator = $cur_dir->enumerate_children('standard::*', [], undef);
15 while ($file_info = $enumerator->next_file(undef)) {
16 say 'Path: ' + $file_info->get_name();
17 }
18
19 # Asynchronous I/O
20 $loop = Glib::MainLoop->new();
21 $file = Glib::IO::File::new_for_path('/etc/passwd');
22 $file->query_info_async('access::can-read,access::can-write', [], 0, sub {
23 my ($file, $res, $data) = @_;
24 my $info = $file->query_info_finish();
25 say 'Can read: ' + $info->get_attribute_boolean('access::can-read');
26 say 'Can write: ' + $info->get_attribute_boolean('access::can-write');
27 $loop->quit();
28 });
29 $loop->run();
30
31 # Platform API
32 $network_monitor = Glib::IO::NetworkMonitor::get_default();
33 say 'Connected: ', $network_monitor->get_network_available() ? 'Yes' : 'No';
34
36 Perl bindings to the GIO library. This modules allows you to write
37 portable code to perform synchronous and asynchronous I/O; implement
38 IPC clients and servers using the DBus specification; interact with the
39 operating system and platform using various services.
40
42 The "Glib::IO" module allows a Perl developer to access the GIO
43 library, the high level I/O and platform library of the GNOME
44 development platform. GIO is used for:
45
46 • local and remote enumeration and access of files
47
48 GIO has multiple backends to access local file systems; SMB/CIFS
49 volumes; WebDAV resources; compressed archives; local devices and
50 remote web services.
51
52 • stream based I/O
53
54 Including files, memory buffers, and network streams.
55
56 • low level and high level network operations
57
58 Sockets, Internet addresses, datagram-based connections, and TCP
59 connections.
60
61 • TLS/SSL support for socket connections
62
63 • DNS resolution and proxy
64
65 • low level and high level DBus classes
66
67 GIO allows the implementation of clients and servers, as well as
68 proxying objects over DBus connections.
69
70 Additionally, GIO has a collection of high level classes for writing
71 applications that integrate with the platform, like:
72
73 settings
74 network monitoring
75 a base Application class
76 extensible data models
77 content type matching
78 application information and launch
79
80 For more information, please visit the GIO reference manual available
81 on <https://developer.gnome.org/gio/stable>. The Perl API closely
82 matches the C one, and eventual deviations will be documented here.
83
84 The principles underlying the mapping from C to Perl are explained in
85 the documentation of Glib::Object::Introspection, on which "Glib::IO"
86 is based.
87
88 Glib::Object::Introspection also comes with the "perli11ndoc" program
89 which displays the API reference documentation of all installed
90 libraries organized in accordance with these principles.
91
93 • To discuss Glib::IO and ask questions join gtk-perl-list@gnome.org
94 at <http://mail.gnome.org/mailman/listinfo/gtk-perl-list>.
95
96 • Also have a look at the gtk2-perl website and sourceforge project
97 page, <http://gtk2-perl.sourceforge.net>.
98
99 • Glib
100
101 • Glib::Object::Introspection
102
103 • Gtk3
104
106 Torsten Schönfeld <kaffeetisch@gmx.de>
107 Emmanuele Bassi <ebassi@gnome.org>
108
110 Copyright (C) 2010-2015 by Torsten Schönfeld <kaffeetisch@gmx.de>
111 Copyright 2017 Emmanuele Bassi
112
113 This library is free software; you can redistribute it and/or modify it
114 under the terms of the Lesser General Public License (LGPL). For more
115 information, see http://www.fsf.org/licenses/lgpl.txt
116
117
118
119perl v5.36.0 2022-07-22 Glib::IO(3)