From: Jeroen van Wolffelaar Date: Thu, 2 Feb 2006 11:00:52 +0000 (+0000) Subject: Read options from stdin when called from PHP, nuke tons of warnings by setting X-Git-Tag: switch-to-templates~202 X-Git-Url: https://git.deb.at/w?a=commitdiff_plain;h=f1043c524ddbe31acc8e2af063bd082e8c808513;p=deb%2Fpackages.git Read options from stdin when called from PHP, nuke tons of warnings by setting $debug if not defined --- diff --git a/cgi-bin/search_packages.pl b/cgi-bin/search_packages.pl index 060602a..6b4a467 100755 --- a/cgi-bin/search_packages.pl +++ b/cgi-bin/search_packages.pl @@ -44,12 +44,18 @@ my %ARCHITECTURES = map { $_ => 1 } @ARCHITECTURES; $ENV{PATH} = "/bin:/usr/bin"; # Read in all the variables set by the form -my $input = new CGI; +my $input; +if ($ARGV[0] eq 'php') { + $input = new CGI(\*STDIN); +} else { + $input = new CGI; +} my $pet0 = new Benchmark; # use this to disable debugging in production mode completly my $debug_allowed = 1; my $debug = $debug_allowed && $input->param("debug"); +$debug = 0 if not defined($debug); $Search::Param::debug = 1 if $debug > 1; # If you want, just print out a list of all of the variables and exit.