[libnet-dbus-perl] 58/335: Added warning message about invalid interface names. Allow params, or returns to be omitted, in which case they are exported as zero-arg

Intrigeri intrigeri at moszumanska.debian.org
Sat Mar 21 01:07:23 UTC 2015


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 ca7d4cab22d24b2e90842e7152b78c83d5e39d33
Author: Daniel P. Berrange <dan at berrange.com>
Date:   Sun Aug 14 17:57:56 2005 +0000

    Added warning message about invalid interface names. Allow params, or returns to be omitted, in which case they are exported as zero-arg
---
 lib/Net/DBus/Exporter.pm | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/lib/Net/DBus/Exporter.pm b/lib/Net/DBus/Exporter.pm
index 578940c..ee6f6b2 100644
--- a/lib/Net/DBus/Exporter.pm
+++ b/lib/Net/DBus/Exporter.pm
@@ -274,6 +274,10 @@ sub import {
     die "usage: use Net::DBus::Exporter 'interface-name';" unless @_;
 
     my $interface = shift;
+    die "interface name '$interface' is not valid." .
+	"Names must consist of tokens using the characters a-z, A-Z, 0-9, _, " .
+	"with at least two tokens, separated by '.'\n"
+	unless $interface =~ /^[a-zA-Z]\w*(\.[a-zA-Z]\w*)+$/;
     $dbus_exports{$caller}->{interface} = $interface;
 
     $class->export_to_level(1, "", @EXPORT);
@@ -281,7 +285,7 @@ sub import {
 
 sub dbus_introspector {
     my $object = shift;
-    
+
     my $class = ref($object);
     die "$object must be a blessed reference" unless $class;
 
@@ -324,6 +328,9 @@ sub dbus_method {
     my $name = shift;
     my $params = shift;
     my $returns = shift;
+
+    $params = [] unless defined $params;
+    $returns = [] unless defined $returns;
     
     my $caller = caller;
     my $is = $dbus_exports{$caller};
@@ -345,6 +352,8 @@ sub dbus_signal {
     my $name = shift;
     my $params = shift;
     
+    $params = [] unless defined $params;
+
     my $caller = caller;
     my $is = $dbus_exports{$caller};
     

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



More information about the Pkg-perl-cvs-commits mailing list