[LON-CAPA-cvs] cvs: modules /gerd/scantron scantronserver.pl

www lon-capa-cvs@mail.lon-capa.org
Tue, 25 May 2004 02:26:10 -0000


www		Mon May 24 22:26:10 2004 EDT

  Modified files:              
    /modules/gerd/scantron	scantronserver.pl 
  Log:
  Printing out read data. The rest will depend on the form we will actually
  use.
  
  
Index: modules/gerd/scantron/scantronserver.pl
diff -u modules/gerd/scantron/scantronserver.pl:1.3 modules/gerd/scantron/scantronserver.pl:1.4
--- modules/gerd/scantron/scantronserver.pl:1.3	Mon May 24 18:00:09 2004
+++ modules/gerd/scantron/scantronserver.pl	Mon May 24 22:26:10 2004
@@ -73,6 +73,12 @@
 #
 sub analyse {
     my ($client,$data)=@_;
-    print "\nData: ".unpack('h*',$data)."\n";
+    my $bindata=unpack('b*',$data);
+    my $columns=(length($bindata)-8)/16;
+    for (my $col=$columns-1; $col>=0; $col--) {
+	my $content=substr($bindata,8 +$col*16,6).
+	            substr($bindata,16+$col*16,6);
+	print "$col $content\n";
+    }
     print $client "3\n";
 }