File Coverage

blib/lib/Glib/IO.pm
Criterion Covered Total %
statement 7 9 77.7
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 10 12 83.3


line stmt bran cond sub pod time code
1             package Glib::IO;
2             $Glib::IO::VERSION = '0.001';
3             =encoding utf8
4              
5             =head1 NAME
6              
7             Glib::IO - Perl bindings to the GIO library
8              
9             =head1 SYNOPSIS
10              
11             use Glib;
12             use Glib::IO;
13              
14             # Synchronous I/O
15             $cur_dir = Glib::IO::File::new_for_path('.');
16             $enumerator = $cur_dir->enumerate_children('standard::*', [], undef);
17             $file_info = $enumerator->next_file(undef);
18             while ($next_file) {
19             say 'Path: ' + $file_info->get_name();
20             }
21              
22             # Asynchronous I/O
23             $loop = Glib::MainLoop->new();
24             $file = Glib::IO::File::new_for_path('/etc/passwd');
25             $file->query_info_async('access::can-read,access::can-write', [], 0, sub {
26             my ($file, $res, $data) = @_;
27             my $info = $file->query_info_finish();
28             say 'Can read: ' + $info->get_attribute_boolean('access::can-read');
29             say 'Can write: ' + $info->get_attribute_boolean('access::can-write');
30             $loop->quit();
31             }
32             $loop->run();
33              
34             # Platform API
35             $network_monitor = Glib::IO::NetworkMonitor::get_default();
36             say 'Connected: ', $network_monitor->get_network_available() ? 'Yes' : 'No';
37              
38             =head1 ABSTRACT
39              
40             Perl bindings to the GIO library. This modules allows you to write portable
41             code to perform synchronous and asynchronous I/O; implement IPC clients and
42             servers using the DBus specification; interact with the operating system and
43             platform using various services.
44              
45             =head1 DESCRIPTION
46              
47             The C module allows a Perl developer to access the GIO library, the
48             high level I/O and platform library of the GNOME development platform. GIO is
49             used for:
50              
51             =over
52              
53             =item * local and remote enumeration and access of files
54              
55             GIO has multiple backends to access local file systems; SMB/CIFS volumes;
56             WebDAV resources; compressed archives; local devices and remote web services.
57              
58             =item * stream based I/O
59              
60             Including files, memory buffers, and network streams.
61              
62             =item * low level and high level network operations
63              
64             Sockets, Internet addresses, datagram-based connections, and TCP connections.
65              
66             =item * TLS/SSL support for socket connections
67              
68             =item * DNS resolution and proxy
69              
70             =item * low level and high level DBus classes
71              
72             GIO allows the implementation of clients and servers, as well as proxying
73             objects over DBus connections.
74              
75             =back
76              
77             Additionally, GIO has a collection of high level classes for writing
78             applications that integrate with the platform, like:
79              
80             =over
81              
82             =item settings
83              
84             =item network monitoring
85              
86             =item a base Application class
87              
88             =item extensible data models
89              
90             =item content type matching
91              
92             =item application information and launch
93              
94             =back
95              
96             For more information, please visit the GIO reference manual available on
97             L. The Perl API closely matches the
98             C one, and eventual deviations will be documented here.
99              
100             The principles underlying the mapping from C to Perl are explained in the
101             documentation of L, on which C is based.
102              
103             L also comes with the C program which
104             displays the API reference documentation of all installed libraries organized
105             in accordance with these principles.
106              
107             =cut
108              
109 5     5   363920 use strict;
  5         14  
  5         211  
110 5     5   33 use warnings;
  5         12  
  5         210  
111 5     5   4442 use Glib::Object::Introspection;
  0            
  0            
112              
113             my $GIO_BASENAME = 'Gio';
114             my $GIO_VERSION = '2.0';
115             my $GIO_PACKAGE = 'Glib::IO';
116              
117             sub import {
118             Glib::Object::Introspection->setup(
119             basename => $GIO_BASENAME,
120             version => $GIO_VERSION,
121             package => $GIO_PACKAGE);
122             }
123              
124             #=head2 Customizations and overrides
125             #
126             #=cut
127              
128             1;
129             __END__