Here's the basics:
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"; }
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):
perl.exe wordnet-ipc.pl
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. --Clinton

In reply to Re^3: Absolute simplest way to keep a database variable persistent? by clwolfe
in thread Absolute simplest way to keep a database variable persistent? by natestraight

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.