/usr/lib/x86_64-linux-gnu/perl5/5.26/Net/DBus/GLib.pm is in libnet-dbus-glib-perl 0.33.0-2build2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | # -*- perl -*-
#
# Copyright (C) 2006-2008 Daniel P. Berrange
#
#
# This program is free software; You can redistribute it and/or modify
# it under the same terms as Perl itself. Either:
#
# a) the GNU General Public License as published by the Free
# Software Foundation; either version 2, or (at your option) any
# later version,
#
# or
#
# b) the "Artistic License"
#
# The file "LICENSE" distributed along with this file provides full
# details of the terms and conditions of the two licenses.
=pod
=head1 NAME
Net::DBus::GLib - Perl extension for the DBus GLib bindings
=head1 SYNOPSIS
####### Attaching to the bus ###########
use Net::DBus::GLib;
# Find the most appropriate bus
my $bus = Net::DBus::GLib->find;
# ... or explicitly go for the session bus
my $bus = Net::DBus::GLib->session;
# .... or explicitly go for the system bus
my $bus = Net::DBus::GLib->system
=head1 DESCRIPTION
Net::DBus::GLib provides an extension to the Net::DBus module
allowing integration with the GLib mainloop. To integrate with
the main loop, simply get a connection to the bus via the methods
in L<Net::DBus::GLib> rather than the usual L<Net::DBus> module.
That's it - every other API remains the same.
=head1 EXAMPLE
As an example service using the GLib main loop, assuming that
SomeObject inherits from Net::DBus::Service
my $bus = Net::DBus::GLib->session();
my $service = $bus->export_service("org.designfu.SampleService");
my $object = SomeObject->new($service);
Glib::MainLoop->new()->run();
And as an example client
my $bus = Net::DBus::GLib->session();
my $service = $bus->get_service("org.designfu.SampleService");
my $object = $service->get_object("/SomeObject");
my $list = $object->HelloWorld("Hello from example-client.pl!");
=head1 METHODS
=over 4
=cut
package Net::DBus::GLib;
use strict;
use warnings;
use Net::DBus;
use Glib;
BEGIN {
our $VERSION = '0.33.0';
require XSLoader;
XSLoader::load('Net::DBus::GLib', $VERSION);
}
=item my $bus = Net::DBus::GLib->find(%params);
Search for the most appropriate bus to connect to and
return a connection to it. For details of the heuristics
used, consult the method of the same name in C<Net::DBus>.
The %params hash may contain an additional entry with a
name of C<context>. This can be a reference to an instance
of the C<Glib::MainContext> object; if omitted, the default
GLib context will be used.
=cut
sub find {
my $class = shift;
my %params = @_;
my $ctx = exists $params{context} ? $params{context} : Glib::MainContext->default;
delete $params{context};
my $bus = Net::DBus->find(nomainloop => 1, @_);
_dbus_connection_setup_with_g_main($bus->get_connection->{connection}, $ctx);
return $bus;
}
=item my $bus = Net::DBus::GLib->system(%params);
Return a handle for the system message bus. For further
details on this method, consult to the method of the
same name in L<Net::DBus>. The %params hash may contain an
additional entry with a name of C<context>. This can be a
reference to an instance of the C<Glib::MainContext> object;
if omitted, the default GLib context will be used.
=cut
sub system {
my $self = shift;
my %params = @_;
my $ctx = exists $params{context} ? $params{context} : Glib::MainContext->default;
delete $params{context};
my $bus = Net::DBus->system(nomainloop => 1, @_);
_dbus_connection_setup_with_g_main($bus->get_connection->{connection}, $ctx);
return $bus;
}
=item my $bus = Net::DBus::GLib->session(%params);
Return a handle for the session message bus. For further
details on this method, consult to the method of the
same name in L<Net::DBus>. The %params hash may contain an
additional entry with a name of C<context>. This can be a
reference to an instance of the C<Glib::MainContext> object;
if omitted, the default GLib context will be used.
=cut
sub session {
my $self = shift;
my %params = @_;
my $ctx = exists $params{context} ? $params{context} : Glib::MainContext->default;
delete $params{context};
my $bus = Net::DBus->session(nomainloop => 1, @_);
_dbus_connection_setup_with_g_main($bus->get_connection->{connection}, $ctx);
return $bus;
}
1;
=pod
=back
=head1 SEE ALSO
L<Net::DBus>, L<Glib>, L<Glib::MainLoop>
C<http://dbus.freedesktop.org>, C<http://gtk.org>
=head1 AUTHOR
Daniel Berrange <dan@berrange.com>
=head1 COPYRIGHT
Copyright 2006-2008 by Daniel Berrange
=cut
|