This is an automated email from the git hooks/post-receive script.

intrigeri pushed a commit to branch experimental
in repository libnet-dbus-perl.

commit 008adf453ae084d290bb5c5846e4701e6ed3516e
Author: Daniel P. Berrange <d...@berrange.com>
Date:   Fri Sep 9 14:06:54 2005 +0000

    Make appending of variant data type work
---
 lib/Net/DBus/Binding/Iterator.pm | 35 ++++++++++++++++++++++++++---------
 1 file changed, 26 insertions(+), 9 deletions(-)

diff --git a/lib/Net/DBus/Binding/Iterator.pm b/lib/Net/DBus/Binding/Iterator.pm
index 9cbe2f9..6536fe5 100644
--- a/lib/Net/DBus/Binding/Iterator.pm
+++ b/lib/Net/DBus/Binding/Iterator.pm
@@ -335,8 +335,10 @@ sub append {
            $self->append_double($value);
        } elsif ($type == &Net::DBus::Binding::Message::TYPE_OBJECT_PATH) {
            $self->append_string($value);
+       } elsif ($type == &Net::DBus::Binding::Message::TYPE_VARIANT) {
+           $self->append_variant($value);
        } else {
-           $self->append_string($value);
+           confess "Unsupported scalar type ", $type;
        }
     }
 }
@@ -367,25 +369,26 @@ sub guess_type {
 }
 
 sub get_signature {
+    my $self = shift;
     my $type = shift;
     my ($sig, $t, $i);
 
     $sig = "";
     $i = 0;
 
-    if (ref ($type) eq "ARRAY") {
+    if (ref($type) eq "ARRAY") {
        while ($i <= $#{$type}) {
            $t = $$type[$i];
            
-           if (ref ($t) eq "ARRAY") {
-               $sig .= &get_signature ($t);
+           if (ref($t) eq "ARRAY") {
+               $sig .= $self->get_signature($t);
            } elsif ($t == &Net::DBus::Binding::Message::TYPE_DICT_ENTRY) {
                $sig .= chr (&Net::DBus::Binding::Message::TYPE_ARRAY);
-               $sig .= "{" . &get_signature ($$type[++$i]) . "}";
+               $sig .= "{" . $self->get_signature($$type[++$i]) . "}";
            } elsif ($t == &Net::DBus::Binding::Message::TYPE_STRUCT) {
-               $sig .= "(" . &get_signature ($$type[++$i]) . ")";
+               $sig .= "(" . $self->get_signature($$type[++$i]) . ")";
            } else {
-               $sig .= chr ($t);
+               $sig .= chr($t);
            }
            
            $i++;
@@ -406,7 +409,7 @@ sub append_array {
     die "array must only have one type"
        if $#{$type} > 0;
 
-    my $sig = get_signature ($type);
+    my $sig = $self->get_signature($type);
     my $iter = 
$self->_open_container(&Net::DBus::Binding::Message::TYPE_ARRAY, $sig);
     
     foreach my $value (@{$array}) {
@@ -444,7 +447,7 @@ sub append_dict {
     my $sig;
 
     $sig  = "{";
-    $sig .= get_signature ($type);
+    $sig .= $self->get_signature($type);
     $sig .= "}";
 
     my $iter = 
$self->_open_container(&Net::DBus::Binding::Message::TYPE_ARRAY, $sig);
@@ -460,6 +463,20 @@ sub append_dict {
     $self->_close_container($iter);
 }
 
+
+sub append_variant {
+    my $self = shift;
+    my $value = shift;
+    
+    my $type = $self->guess_type($value);
+    my $sig = $self->get_signature($type);
+    my $iter = 
$self->_open_container(&Net::DBus::Binding::Message::TYPE_VARIANT, $sig);
+    $iter->append($value, $type);
+    $self->_close_container($iter);
+}
+
+
+
 1;
 
 =pod

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libnet-dbus-perl.git

_______________________________________________
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits

Reply via email to