]> git.donarmstrong.com Git - debbugs.git/commitdiff
* Ignore stupid (and useless) warnings about using a map for hash
authorDon Armstrong <don@donarmstrong.com>
Thu, 4 Dec 2008 03:54:23 +0000 (19:54 -0800)
committerDon Armstrong <don@donarmstrong.com>
Thu, 4 Dec 2008 03:54:23 +0000 (19:54 -0800)
   elements that are numeric

cgi/soap.cgi
t/09_soap.t

index f6b0d0410c4daeeb5f29dbd4a6a7e3ae9e0615fc..2b68ddd2f89850698edfdff45de6fffe0770ad74 100755 (executable)
@@ -1,4 +1,7 @@
-#!/usr/bin/perl -wT
+#!/usr/bin/perl -T
+
+use warnings;
+use strict;
 
 #use SOAP::Transport::HTTP;
 
@@ -24,5 +27,13 @@ for my $key (keys %{$typelookup}) {
      next unless defined $_ and /Month|Day|Year|date|time|duration/i;
      delete $typelookup->{$key};
 }
-$soap->handle;
 
+our $warnings = '';
+eval {
+    # Ignore stupid warning because elements (hashes) can't start with
+    # numbers
+    local $SIG{__WARN__} = sub {$warnings .= $_[0] unless $_[0] =~ /Cannot encode unnamed element/};
+    $soap->handle;
+};
+die $@ if $@;
+warn $warnings if length $warnings;
index 2a04c60e07da530176262ced80b81d4150a16690..4967a9c8a15baff7cf123fd935eb97929754b756 100644 (file)
@@ -81,20 +81,33 @@ else {
      eval q(
      use Debbugs::SOAP::Server;
      @Debbugs::SOAP::Server::ISA = qw(SOAP::Transport::HTTP::Daemon);
-     Debbugs::SOAP::Server
+     our $warnings = '';
+     eval {
+       # Ignore stupid warning because elements (hashes) can't start with
+       # numbers
+       local $SIG{__WARN__} = sub {$warnings .= $_[0] unless $_[0] =~ /Cannot encode unnamed element/};
+       Debbugs::SOAP::Server
               ->new(LocalAddr => 'localhost', LocalPort => $port)
                    ->dispatch_to('/','Debbugs::SOAP')
                         ->handle;
+      };
+      die $@ if $@;
+      warn $warnings if length $warnings;
+
      );
 }
 
 use SOAP::Lite;
 my $soap = SOAP::Lite->uri('Debbugs/SOAP')->proxy('http://localhost:'.$port.'/');
 #ok($soap->get_soap_version->result == 1,'Version set and got correctly');
-my $bugs = $soap->get_bugs(package => 'foo')->result;
+my $bugs_result = $soap->get_bugs(package => 'foo');
+my $bugs = $bugs_result->result;
 use Data::Dumper;
+#print STDERR Dumper($bugs_result);
 ok(@{$bugs} == 1 && $bugs->[0] == 1, 'get_bugs returns bug number 1') or fail(Dumper($bugs));
-my $status = $soap->get_status(1)->result;
+my $status_result = $soap->get_status(1);
+#print STDERR Dumper($status_result);
+my $status = $status_result->result;
 ok($status->{1}{package} eq 'foo','get_status thinks that bug 1 belongs in foo') or fail(Dumper($status));
 
 # Test the usertags at some point