W3C home > Mailing lists > Public > www-annotation@w3.org > January to June 2002

Re: Installing annotation server on Windows

From: Matthew Wilson <matthew@mjwilson.demon.co.uk>
Date: Tue, 12 Mar 2002 19:19:36 +0000
Message-Id: <4.3.2.7.1.20020312190921.00b3dad0@pop3.demon.co.uk>
To: www-annotation@w3.org
Here is patch describing the changes I made to code to get the annotation 
server running (compiling, not fully functioning) on Windows NT.

Notes:
1. Both access and annotate have the first line changed to point to the 
directory of the Perl executable. [-- In fact I've just noticed that access 
replaces the parameter with a new value. I meant to delete it, as in the 
annotate script.]

2. Both access and annotate have the 'storeIn' parameter removed from the 
Debug constructor. This leaves the W3CDebugCGI object to determine the 
directory.

3. Fixed a small error in the namespace exception object (I think).

4. Changed W3CDebugCGI to use the built-in time function instead of `date` 
(since the output of the `date` command is OS-dependent). (The only change 
here is that a numerical value of the day of the week is used instead of 
the name of the day of the week). This change should work cross-platform. 
Similarly the stuff with syscall is replaced by the use of the module 
Time::HiRes, available from CPAN and easily installed on Windows systems. 
Again this change should work cross-platform.

5. Changed W3CDebugCGI to default to the directory C:/temp instead of /tmp. 
Probably this should be changed to do some -d tests to try and find an 
existing directory.

The configuration also needed some changing, in particular, in the Conf 
directory, a file annotate.prop was needed with an entry

auth.database.parms: -type => 'sdbm', -file => '[path to DBM user file]'

The path here should use forward-slashes as a directory separator, not 
backslashes.

This still does not make the server fully functional. After POSTing a 
couple of annotations, trying to retrieve them gave the errors

Error dumping
[http://localhost/annotate/attribution/1015861599.94000#genid1]:
unknown namespace: "W3C" '((?p W3C::Rdf::Uri=HASH(0x27bfacc) ?o)
Error dumping
[http://localhost/annotate/attribution/1015862081.618000#genid1]:
unknown namespace: "W3C" '((?p W3C::Rdf::Uri=HASH(0x27bb138) ?o)

Not sure why this is the case.

Matthew

Index: perl/modules/W3C/Annotations/CGI/access
===================================================================
RCS file: /sources/public/perl/modules/W3C/Annotations/CGI/access,v
retrieving revision 1.31
diff -u -r1.31 access
--- access	2001/07/23 01:43:08	1.31
+++ access	2002/03/12 12:40:52
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!D:/Perl/bin/perl

  ## accounts: an account administrator designed for use
  #  with the W3C Annotations project.
@@ -68,7 +68,7 @@
      eval {
  	$W3C::Util::W3CDebugCGI::DEBUG_SESSION = $ARGV[1]; # use a session id 
like 957296047.909868;
  	$query = new W3C::Util::W3CDebugCGI($0, $ARGV[0] eq 'DEBUG',
-					    {-storeIn => '/tmp',
+					    {-storeIn => 'C:/temp',
  					     -dieNoOpen => 1, -logExt => '.log',
  					     -rerun => 'w3c_rerun',
  					     -reconstruct => 'reconstruct'});
Index: perl/modules/W3C/Annotations/CGI/annotate
===================================================================
RCS file: /sources/public/perl/modules/W3C/Annotations/CGI/annotate,v
retrieving revision 1.129
diff -u -r1.129 annotate
--- annotate	2002/03/08 22:37:42	1.129
+++ annotate	2002/03/12 12:40:52
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!D:/Perl/bin/perl

  ## W3C annotate - store annotations into, and query from, a persistant RDF DB

@@ -199,7 +199,6 @@
      $query = new W3C::Util::W3CDebugCGI($0, $ARGV[0] eq 'DEBUG',
  					{-dieNoOpen => 1,
  					 -logExt => '.log',
-					 -storeIn => '/tmp',
  					 -rerun => 'w3c_rerun',
  					 -mergeQueryAndPOST => 1});

@@ -805,8 +804,8 @@
    <hr />
    <h2><a name=\"byUri\">Query Annotations</a></h2>
    <form method=\"get\" action=\"$selfUri\">
-    annotation to retreive: <input name=\"w3c_annotation\" size=55 
value=\"$displayAnnotationId\"><br>
-    body to retreive: <input name=\"w3c_body\" size=55 
value=\"$displayBodyId\"><br>
+    annotation to retrieve: <input name=\"w3c_annotation\" size=55 
value=\"$displayAnnotationId\"><br>
+    body to retrieve: <input name=\"w3c_body\" size=55 
value=\"$displayBodyId\"><br>
      uris to check for annotations: <input name=\"w3c_annotates\" size=55 
value=\"$displayAnnotates\"><br>
      threads: <input name=\"w3c_replyTree\" size=55 
value=\"$displayThread\"><br>
      <textarea name=\"w3c_algaeQuery\" rows=\"13\" 
cols=\"100\">$displayAlgaeQuery</textarea><br>
Index: perl/modules/W3C/SAX/HandlerBase.pm
===================================================================
RCS file: /sources/public/perl/modules/W3C/SAX/HandlerBase.pm,v
retrieving revision 1.41
diff -u -r1.41 HandlerBase.pm
--- HandlerBase.pm	2001/12/17 17:55:29	1.41
+++ HandlerBase.pm	2002/03/12 12:40:54
@@ -25,7 +25,7 @@
      my ($proto, @parms) = @_;
      my $class = ref($proto) || $proto;
      my $self = $class->SUPER::new(@parms);
-    $self->missingParm('-namespace') if (!$self->{-target});
+    $self->missingParm('-namespace') if (!$self->{-namespace});
      $self->fillInStackTrace;
      return $self;
  }
Index: perl/modules/W3C/Util/W3CDebugCGI.pm
===================================================================
RCS file: /sources/public/perl/modules/W3C/Util/W3CDebugCGI.pm,v
retrieving revision 1.76
diff -u -r1.76 W3CDebugCGI.pm
--- W3CDebugCGI.pm	2002/02/27 09:45:58	1.76
+++ W3CDebugCGI.pm	2002/03/12 12:40:55
@@ -44,27 +44,25 @@
  	    $self = {%$headerLineOrNameOrSibling};
  	    $self->{ENTRY_TYPE} = $entryType;
  	} else {
-	    require 'sys/syscall.ph';
-	    my $timestamp=pack('LL', ());
-	    syscall( &SYS_gettimeofday, $timestamp, 0) != -1 ||
-		&throw(new W3C::Util::Exception(-message => "gettimeofday: $!"));
-	    my @timestamp = unpack('LL', $timestamp);
+	    use Time::HiRes qw/gettimeofday/;
+        my @timestamp = gettimeofday();
+	    $self->{SESSION_ID} = $timestamp[0].'.'.$timestamp[1];
+	    my $timestamp = $self->{SESSION_ID}.' '.`date`;
+
  	    my $sessionId = $timestamp[0].'.'.$timestamp[1];
-	    my $dateStr = `date`;
-	    if ($dateStr !~ m/^(\w+) (\w+)\s+(\d+) (\d+):(\d+):(\d+) (?:(\w+) 
)?(\d+)$/) {
-		&throw(new W3C::Util::Exception(-message => "bad date \"$dateStr\""));
-	    }
+
+        my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = 
localtime(time);
  	    $self = {NAME => $headerLineOrNameOrSibling,
  		     ENTRY_TYPE => $entryType,
  		     SESSION_ID => $sessionId,
-		     DAY => $1,
-		     MON => $MonStrToNum{$2},
-		     DATE => $3,
-		     HOUR => $4,
-		     MIN => $5,
-		     SEC => $6,
-		     ZONE => $7,
-		     YEAR => $8};
+		     DAY => $wday,  # should be _name of_ day of week
+		     MON => 1+$mon,
+		     DATE => $mday,
+		     HOUR => $hour,
+		     MIN => $min,
+		     SEC => $sec,
+		     ZONE => $ENV{'TZ'},
+		     YEAR => 1900+$year};
  	}
      } else {
  	if ($headerLineOrNameOrSibling !~ m/^([^\s]+) (\w+ )?([0-9\.]+) (\w+) 
(\w+)\s+(\d+) (\d+):(\d+):(\d+) (?:(\w+) )?(\d+)$/) {
@@ -207,7 +205,7 @@
      $scriptName =~ m/([\w\-\.]+)/;
      $scriptName = $1;
      $reUseCGI = 0 if (!defined $reUseCGI);
-    $storeIn = '/tmp/' if (!defined $storeIn);
+    $storeIn = 'C:/temp/' if (!defined $storeIn);
      $storeIn .= '/' if($storeIn !~ /\/\Z/);
      my ($baseName, $self);
      #($baseName = $scriptName) =~ s/^.*\/([^\/\.]+).*$/$1/;
Received on Tuesday, 12 March 2002 14:20:28 GMT

This archive was generated by hypermail 2.2.0 + w3c-0.30 : Friday, 25 March 2005 11:19:17 GMT