[LON-CAPA-cvs] cvs: loncom /cgi ping.pl

albertel lon-capa-cvs-allow@mail.lon-capa.org
Tue, 17 Apr 2007 23:18:43 -0000


albertel		Tue Apr 17 19:18:43 2007 EDT

  Modified files:              
    /loncom/cgi	ping.pl 
  Log:
  - removal of reply function
  
  
Index: loncom/cgi/ping.pl
diff -u loncom/cgi/ping.pl:1.5 loncom/cgi/ping.pl:1.6
--- loncom/cgi/ping.pl:1.5	Sun Aug 31 23:37:27 2003
+++ loncom/cgi/ping.pl	Tue Apr 17 19:18:42 2007
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 # ping cgi-script
-# $Id: ping.pl,v 1.5 2003/09/01 03:37:27 albertel Exp $
+# $Id: ping.pl,v 1.6 2007/04/17 23:18:42 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -25,42 +25,14 @@
 # http://www.lon-capa.org/
 #
 
-
+use strict;
 $|=1;
 
 use lib '/home/httpd/lib/perl/';
-use LONCAPA::Configuration;
-
-use IO::File;
-use IO::Socket;
-
-my %perlvar;
-
-# -------------------------------------------------- Non-critical communication
-sub reply {
-    my ($cmd,$server)=@_;
-    my $peerfile="$perlvar{'lonSockDir'}/$server";
-    my $client=IO::Socket::UNIX->new(Peer    =>"$peerfile",
-                                     Type    => SOCK_STREAM,
-                                     Timeout => 10)
-       or return "con_lost";
-    print $client "$cmd\n";
-    my $answer=<$client>;
-    chomp($answer);
-    if (!$answer) { $answer="con_lost"; }
-    return $answer;
-}
-
-
-# --------------------- Read loncapa.conf (and by default loncapa_apache.conf).
-my $perlvarref=LONCAPA::Configuration::read_conf('loncapa.conf');
-%perlvar=%{$perlvarref};
-undef $perlvarref; # remove since sensitive and not needed
-delete $perlvar{'lonReceipt'}; # remove since sensitive and not needed
-delete $perlvar{'lonSqlAccess'}; # remove since sensitive and not needed
+use Apache::lonnet;
 
-$testhost=$ENV{'QUERY_STRING'};
+my $testhost=$ENV{'QUERY_STRING'};
 $testhost=~s/\W//g;
 
-print "Content-type: text/plain\n\n".
-      &reply('ping',$testhost)."\n";
+print("Content-type: text/plain\n\n".
+      &Apache::lonnet::reply('ping',$testhost)."\n");