Subject: | [PATCH] publish throws warnings |
This module tends to throw the following warning:
Use of uninitialized value in split at
/usr/share/perl5/Net/Rendezvous/Publish/Backend/Avahi.pm line 39.
The problem is the handling of the (undocumented) txt argument.
Attached is an (untested) patch which should fix this.
Subject: | Avahi.patch |
--- Avahi.pm.orig 2007-05-07 07:13:11.000000000 +0200
+++ Avahi.pm 2010-11-25 13:48:21.618178003 +0100
@@ -26,20 +26,30 @@
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);
- # AddService argument signature is aay. Split first into key/value
- # pairs at character \x01, then map characters to bytes and add DBus
- # type.
- [map {
- [map {
- Net::DBus::dbus_byte(ord($_))
- } (split //, $_)]
- } (split /\x01/, $args{txt})]);
$group->Commit;
return $group;