X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=cgi%2Fsoap.cgi;h=b4039214dd3bc33717a592d171c738275c845d30;hb=HEAD;hp=53f7368536f4327b4a71b60acd59a9ce811250d8;hpb=8b40c099ffd3f1a46ba40eed9d572dc8b4211f0e;p=debbugs.git diff --git a/cgi/soap.cgi b/cgi/soap.cgi index 53f7368..b403921 100755 --- a/cgi/soap.cgi +++ b/cgi/soap.cgi @@ -3,6 +3,29 @@ use warnings; use strict; +# if we're running out of git, we want to use the git base directory as the +# first INC directory. If you're not running out of git, don't do that. +use File::Basename qw(dirname); +use Cwd qw(abs_path); +our $debbugs_dir; +BEGIN { + $debbugs_dir = + abs_path(dirname(abs_path(__FILE__)) . '/../'); + # clear the taint; we'll assume that the absolute path to __FILE__ is the + # right path if there's a .git directory there + ($debbugs_dir) = $debbugs_dir =~ /([[:print:]]+)/; + if (defined $debbugs_dir and + -d $debbugs_dir . '/.git/') { + } else { + undef $debbugs_dir; + } + # if the first directory in @INC is not an absolute directory, assume that + # someone has overridden us via -I. + if ($INC[0] !~ /^\//) { + } +} +use if defined $debbugs_dir, lib => $debbugs_dir.'/lib/'; + #use SOAP::Transport::HTTP; use Debbugs::SOAP::Server; @@ -28,7 +51,12 @@ my $soap = Debbugs::SOAP::Server # kill off all of the date/time related bits in the serializer. my $typelookup = $soap->serializer()->{_typelookup}; for my $key (keys %{$typelookup}) { - delete $typelookup->{$key} if defined $key and $key =~ /Month|Day|Year|date|time|duration/i; + if (defined $key and + $key =~ /Month|Day|Year|date|time|duration/i + ) { + # set the sub to always return 0 + $typelookup->{$key}[1] = sub { 0 }; + } } our $warnings = '';