From f1043c524ddbe31acc8e2af063bd082e8c808513 Mon Sep 17 00:00:00 2001 From: Jeroen van Wolffelaar Date: Thu, 2 Feb 2006 11:00:52 +0000 Subject: [PATCH] Read options from stdin when called from PHP, nuke tons of warnings by setting $debug if not defined --- cgi-bin/search_packages.pl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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. -- 2.39.2