in reply to Re^2: Absolute simplest way to keep a database variable persistent?
in thread Absolute simplest way to keep a database variable persistent?
Now then, that's the Perl side. You can test it from the command line like this (if you saved it in wordnet-ipc.pl):use strict; # This turns off output buffering, so output is immediate. $| = 1; # Load Wordnet use WordNet::QueryData; # Adjust location as needed my $wordnet = WordNet::QueryData->new("wordnet.db"); # This reads lines from STDIN. If there is no input, # it waits. while (my $input = <>) { # Remove the newline from the end chomp $input; # Here we have to think about a protocol. # I suggest something of the form command;arg1;arg2 my ($command, $arg1, $arg2) = split ';', $input; my @results; # Dispatch based on command if ($command eq 'quit') { exit; } elsif ($command eq 'word') { # Do a WordNet queryWord @results = $wordnet->queryWord($arg1, $arg2); } elsif ($command eq 'sense') { @results = $wordnet->querySense($arg1, $arg2); } else { die "Unknown command $command"; } # OK, send the results back out over STDOUT my $line = join ',', @results; print $line . "\n"; }
It should appear to "hang", but really it's just waiting on your input. Try typing sense;run#v. To exit, type exit. The part I'm still fuzzy on is how to start up a process from VBA and get stream objects on it's input and output. I'm on a linux box now, so I don't have access to my VBA docs. I'll try to have a shot at it when I get home. --Clintonperl.exe wordnet-ipc.pl
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Absolute simplest way to keep a database variable persistent?
by natestraight (Novice) on Oct 10, 2008 at 00:10 UTC | |
by clwolfe (Scribe) on Oct 11, 2008 at 03:37 UTC | |
by natestraight (Novice) on Oct 12, 2008 at 13:37 UTC |