6 # if we're running out of git, we want to use the git base directory as the
7 # first INC directory. If you're not running out of git, don't do that.
8 use File::Basename qw(dirname);
13 abs_path(dirname(abs_path(__FILE__)) . '/../');
14 # clear the taint; we'll assume that the absolute path to __FILE__ is the
15 # right path if there's a .git directory there
16 ($debbugs_dir) = $debbugs_dir =~ /([[:print:]]+)/;
17 if (defined $debbugs_dir and
18 -d $debbugs_dir . '/.git/') {
22 # if the first directory in @INC is not an absolute directory, assume that
23 # someone has overridden us via -I.
24 if ($INC[0] !~ /^\//) {
27 use if defined $debbugs_dir, lib => $debbugs_dir;
29 #use SOAP::Transport::HTTP;
31 use Debbugs::SOAP::Server;
33 # Work around stupid soap bug on line 411
34 if (not exists $ENV{EXPECT}) {
38 my $soap = Debbugs::SOAP::Server
39 #my $soap = SOAP::Transport::HTTP::CGI
40 -> dispatch_to('Debbugs::SOAP');
41 #$soap->serializer()->soapversion(1.2);
42 # soapy is stupid, and is using the 1999 schema; override it.
43 *SOAP::XMLSchema1999::Serializer::as_base64Binary = \&SOAP::XMLSchema2001::Serializer::as_base64Binary;
44 *SOAP::Serializer::as_anyURI = \&SOAP::XMLSchema2001::Serializer::as_string;
45 # do this twice to avoid the warning if the serializer doesn't get
47 *SOAP::XMLSchema1999::Serializer::as_base64Binary = \&SOAP::XMLSchema2001::Serializer::as_base64Binary;
48 *SOAP::Serializer::as_anyURI = \&SOAP::XMLSchema2001::Serializer::as_string;
49 # to work around the serializer improperly using date/time stuff
50 # (Nothing in Debbugs should be looked at as if it were date/time) we
51 # kill off all of the date/time related bits in the serializer.
52 my $typelookup = $soap->serializer()->{_typelookup};
53 for my $key (keys %{$typelookup}) {
55 $key =~ /Month|Day|Year|date|time|duration/i
57 # set the sub to always return 0
58 $typelookup->{$key}[1] = sub { 0 };
64 # Ignore stupid warning because elements (hashes) can't start with
66 local $SIG{__WARN__} = sub {$warnings .= $_[0] unless $_[0] =~ /Cannot encode unnamed element/};
70 warn $warnings if length $warnings;