Skip Menu |

This queue is for tickets about the Net-DBus CPAN distribution.

Report information
The Basics
Id: 21212
Status: resolved
Priority: 0/
Queue: Net-DBus

People
Owner: Nobody in particular
Requestors: emmanuel.rodriguez [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.33.3
Fixed in: (no value)



Subject: Net::DBus::Binding::Message missing variant type
The module Net::DBus::Binding::Message is missing the declaration of the type 'variant' in the hash %simple_type_map and in it's reverse lookup %simple_type_rev_map. The absence of this type causes the Perl library to fail when communicating with the service provided by 'org.freedesktop.Notifications' as decribed here: http://www.galago-project.org/specs/notification/0.9/x408.html The error message is: unknown simple type variant at /usr/lib/perl5/Net/DBus/Binding/Introspector.pm line 994 A sample test case and a patch are provided.
Subject: dbus.patch
--- /usr/lib/perl5/Net/DBus/Binding/Introspector.pm 2006-08-29 00:03:52.000000000 +0200 +++ Introspector.pm 2006-07-06 00:34:37.000000000 +0200 @@ -53,6 +53,7 @@ use 5.006; use strict; use warnings; + use XML::Twig; use Net::DBus::Binding::Message; @@ -70,7 +71,6 @@ "uint64" => &Net::DBus::Binding::Message::TYPE_UINT64, "objectpath" => &Net::DBus::Binding::Message::TYPE_OBJECT_PATH, "signature" => &Net::DBus::Binding::Message::TYPE_SIGNATURE, - "variant" => &Net::DBus::Binding::Message::TYPE_VARIANT, ); our %simple_type_rev_map = ( @@ -86,7 +86,6 @@ &Net::DBus::Binding::Message::TYPE_UINT64 => "uint64", &Net::DBus::Binding::Message::TYPE_OBJECT_PATH => "objectpath", &Net::DBus::Binding::Message::TYPE_SIGNATURE => "signature", - &Net::DBus::Binding::Message::TYPE_VARIANT => "variant", ); our %magic_type_map = (
Subject: dbus-test-case.pl
#!/usr/bin/perl =head1 NAME dbus-test-case.pl - Sample DBUS test case. =head1 SYNOPSIS dbus-test-case.pl =head1 DESCRIPTION Sample program used to demonstrate a failure with the Net::DBUS API. =head1 AUTHOR Emmanuel Rodriguez < emmanuel.rodriguez@gmail.com > =cut use strict; use warnings; use Net::DBus; # Main entry point exit main(); # # Main entry point of the program # sub main { my $dbus = Net::DBus->session; my $service = $dbus->get_service("org.freedesktop.Notifications"); my $object = $service->get_object("/org/freedesktop/Notifications"); # Send and notification $object->Notify( "dbus-test", # Application name 0, # replaces_id (0 -> nothing) '', #app_icon ("" -> no icon) 'Test event', # summary "This is a test to see if DBUS works nicely in Perl.\nI hope that this works.", # body [], # actions {}, # hints 2_000 # expire_timeout in milliseconds ); return 0; }
Thanks for the test case - I've reproduced it on one of my development systems. The patch you supplied although fixing the immediate crash is not quite correct. The variant data type is actually a compound data type, so can't be treated in same was as normal scalar data types. Fortunately the correct patch is very easy - it was simply a typo elsewhere in the file. I am attaching the patch to this ticket & will include it in the next release of the Net::DBus module. Regards, Dan
diff -r dcd5f5a47389 lib/Net/DBus/Binding/Introspector.pm --- a/lib/Net/DBus/Binding/Introspector.pm Sun Aug 20 19:39:49 2006 -0400 +++ b/lib/Net/DBus/Binding/Introspector.pm Mon Aug 28 19:11:12 2006 -0400 @@ -702,7 +702,7 @@ sub _parse_type { $current = pop @cont; } } elsif ($type eq "v") { - push @{$current}, "variant"; + push @{$current}, ["variant"]; if ($current->[0] eq "array") { $current = pop @cont; }
The problems identified with handling of variants in this ticket have been resolve in the 0.33.4 release of DBus. The example code here is also used in test cases / example programs to validate the fix is correct.