Glib::IO - Perl bindings to the GIO library
use Glib; use Glib::IO; # Synchronous I/O $cur_dir = Glib::IO::File::new_for_path('.'); $enumerator = $cur_dir->enumerate_children('standard::*', [], undef); while ($file_info = $enumerator->next_file(undef)) { say 'Path: ' + $file_info->get_name(); } # Asynchronous I/O $loop = Glib::MainLoop->new(); $file = Glib::IO::File::new_for_path('/etc/passwd'); $file->query_info_async('access::can-read,access::can-write', [], 0, sub { my ($file, $res, $data) = @_; my $info = $file->query_info_finish(); say 'Can read: ' + $info->get_attribute_boolean('access::can-read'); say 'Can write: ' + $info->get_attribute_boolean('access::can-write'); $loop->quit(); }); $loop->run(); # Platform API $network_monitor = Glib::IO::NetworkMonitor::get_default(); say 'Connected: ', $network_monitor->get_network_available() ? 'Yes' : 'No';
Perl bindings to the GIO library. This modules allows you to write portable code to perform synchronous and asynchronous I/O; implement IPC clients and servers using the DBus specification; interact with the operating system and platform using various services.
The Glib::IO module allows a Perl developer to access the GIO library, the high level I/O and platform library of the GNOME development platform. GIO is used for:
Glib::IO
local and remote enumeration and access of files
GIO has multiple backends to access local file systems; SMB/CIFS volumes; WebDAV resources; compressed archives; local devices and remote web services.
stream based I/O
Including files, memory buffers, and network streams.
low level and high level network operations
Sockets, Internet addresses, datagram-based connections, and TCP connections.
TLS/SSL support for socket connections
DNS resolution and proxy
low level and high level DBus classes
GIO allows the implementation of clients and servers, as well as proxying objects over DBus connections.
Additionally, GIO has a collection of high level classes for writing applications that integrate with the platform, like:
For more information, please visit the GIO reference manual available on https://developer.gnome.org/gio/stable. The Perl API closely matches the C one, and eventual deviations will be documented here.
The principles underlying the mapping from C to Perl are explained in the documentation of Glib::Object::Introspection, on which Glib::IO is based.
Glib::Object::Introspection also comes with the perli11ndoc program which displays the API reference documentation of all installed libraries organized in accordance with these principles.
perli11ndoc
To discuss Glib::IO and ask questions join gtk-perl-list@gnome.org at http://mail.gnome.org/mailman/listinfo/gtk-perl-list.
Also have a look at the gtk2-perl website and sourceforge project page, http://gtk2-perl.sourceforge.net.
Glib
Glib::Object::Introspection
Gtk3
Copyright (C) 2010-2015 by Torsten Schönfeld <kaffeetisch@gmx.de> Copyright 2017 Emmanuele Bassi
This library is free software; you can redistribute it and/or modify it under the terms of the Lesser General Public License (LGPL). For more information, see http://www.fsf.org/licenses/lgpl.txt
To install Glib::IO, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Glib::IO
CPAN shell
perl -MCPAN -e shell install Glib::IO
For more information on module installation, please visit the detailed CPAN module installation guide.