/usr/share/perl5/Net/Rendezvous/Publish/Backend/Avahi.pm is in libnet-rendezvous-publish-backend-avahi-perl 0.04-2.
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 | package Net::Rendezvous::Publish::Backend::Avahi;
{
$Net::Rendezvous::Publish::Backend::Avahi::VERSION = '0.04';
}
# ABSTRACT: Publish zeroconf data via Avahi
# vi: ts=4 sw=4
use strict;
use warnings;
use Net::DBus;
sub new {
my $class = shift;
my $self = {@_};
bless $self, $class;
my $bus = Net::DBus->system;
$self->{service} = $bus->get_service('org.freedesktop.Avahi');
$self->{server} =
$self->{service}->get_object('/', 'org.freedesktop.Avahi.Server');
return $self;
}
sub publish {
my $self = shift;
my %args = @_;
# AddService argument signature is aay. Split first into key/value
# pairs at character \x01 ...
my $txt = $args{txt} || [];
unless (ref $txt) {
$txt = [map { [(split //, $_)] } (split /\x01/, $txt)];
}
# ... then map characters to bytes and add DBus type.
if (@{$txt}) {
foreach my $t (@{$txt}) {
map { $_ = Net::DBus::dbus_byte(ord($_)) } @{$t};
}
}
my $group = $self->{service}->get_object($self->{server}->EntryGroupNew,
'org.freedesktop.Avahi.EntryGroup');
$group->AddService(
Net::DBus::dbus_int32(-1), Net::DBus::dbus_int32(-1),
Net::DBus::dbus_uint32(0), $args{name},
$args{type}, $args{domain},
$args{host}, Net::DBus::dbus_uint16($args{port}),
$txt
);
$group->Commit;
return $group;
}
sub publish_stop {
my $self = shift;
my ($group) = @_;
$group->Free;
}
sub step {
}
1;
__END__
=pod
=head1 NAME
Net::Rendezvous::Publish::Backend::Avahi - Publish zeroconf data via Avahi
=head1 VERSION
version 0.04
=head1 COPYRIGHT AND LICENSE
Copyright (c) 2006 by Jack Bates. All rights reserved.
Copyright (c) 2012 by Ioan Rogers.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=head1 SEE ALSO
=over
=item L<Net::Rendezvous::Publish> - The module this module supports.
=item L<Avahi|http://avahi.org/>
=back
=head1 AUTHORS
=over 4
=item *
Ioan Rogers <ioanr@cpan.org>
=item *
Jack Bates <jablko@cpan.org>
=back
=head1 BUGS AND LIMITATIONS
You can make new bug reports, and view existing ones, through the
web interface at L<https://github.com/ioanrogers/Net-Rendezvous-Publish-Backend-Avahi/issues>.
=head1 SOURCE
The development version is on github at L<http://github.com/ioanrogers/Net-Rendezvous-Publish-Backend-Avahi>
and may be cloned from L<git://github.com/ioanrogers/Net-Rendezvous-Publish-Backend-Avahi.git>
=cut
|