X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=cgi%2Fsoap.cgi;h=53f7368536f4327b4a71b60acd59a9ce811250d8;hb=45f1672bfee50ef8c2ec5938979ee409c5c3db87;hp=b30151ef5cf9f210ac97659031cf298b4ea68101;hpb=16d22ea43c12b5b9ffff446a84b4641aeec3101b;p=debbugs.git diff --git a/cgi/soap.cgi b/cgi/soap.cgi index b30151e..53f7368 100755 --- a/cgi/soap.cgi +++ b/cgi/soap.cgi @@ -1,4 +1,7 @@ -#!/usr/bin/perl -wT +#!/usr/bin/perl -T + +use warnings; +use strict; #use SOAP::Transport::HTTP; @@ -16,13 +19,24 @@ my $soap = Debbugs::SOAP::Server # soapy is stupid, and is using the 1999 schema; override it. *SOAP::XMLSchema1999::Serializer::as_base64Binary = \&SOAP::XMLSchema2001::Serializer::as_base64Binary; *SOAP::Serializer::as_anyURI = \&SOAP::XMLSchema2001::Serializer::as_string; +# do this twice to avoid the warning if the serializer doesn't get +# used +*SOAP::XMLSchema1999::Serializer::as_base64Binary = \&SOAP::XMLSchema2001::Serializer::as_base64Binary; +*SOAP::Serializer::as_anyURI = \&SOAP::XMLSchema2001::Serializer::as_string; # to work around the serializer improperly using date/time stuff # (Nothing in Debbugs should be looked at as if it were date/time) we # kill off all of the date/time related bits in the serializer. my $typelookup = $soap->serializer()->{_typelookup}; -for my $key (keys %{$type_lookup}) { - next unless /Month|Day|Year|date|time|duration/; - delete $type_lookup->{$key}; +for my $key (keys %{$typelookup}) { + delete $typelookup->{$key} if defined $key and $key =~ /Month|Day|Year|date|time|duration/i; } -$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;