Re: [htdig] Problem calling external programs


Gilles Detillieux (grdetil@scrc.umanitoba.ca)
Tue, 13 Jul 1999 09:47:11 -0500 (CDT)


According to Heid Joern:
> I'm sorry because I posted this message before.
> Sadly, no one gives me an answer but there was a reply which doesn't try to
> answer my question.
> So I think it is possible that people how could help me thought that it has
> been answered with that reply.
> If no one could or will answer me the I apologize for this mail.

Most of us are busy people, so you have to be patient sometimes, especially
if it's not a problem that someone has seen recently and can jump in with
a quick answer. Of course, sending reminders can help too, as you've no
doubt noticed. :)

> There's the mail again:
> I have ported ht://dig to Win NT and it works well so far.
> Even the directive
>
> database_dir: /tmp/htdig/db123456
>
> works.
>
> I have successfully run the line
> parse_doc.pl test.pdf
>
> But after adding
>
> external_parsers: application/msword /tmp/htdig/bin/parse_doc.pl \
> application/postscript /tmp/htdig/bin/parse_doc.pl \
> application/pdf /tmp/htdig/bin/parse_doc.pl
>
> the output of htdig is
> 1:2:0:http://www.integraliscentaur.de/test.pdf: /tmp/htdig/bin/parse_doc.pl:
>
> not found
>
> I tried with c:/tmp... and with \\ instead of / with no success.
>
> Does anybody know what to change so that external programs will work on Win
> NT (perhaps changing some c++ code of htdig?).

As Torsten pointed out, you will need to make sure Perl is installed on
your NT system, in order to run the parse_doc Perl script. You will also
need to make sure that the first line of the script gives the correct
path to the Perl interpreter on your system.

It's hard to tell from the error message what exactly it is that's
"not found". It could be the parse_doc.pl script itself, or the perl
interpreter, or simply the fact that the shell doesn't recognize the
whole thing as actually being executable.

I must admit I'm not familiar with NT at all, much less with the Cygwin
package, so I'm taking a shot in the dark here. On UNIX systems, all you
need to do is set execute permission on parse_doc.pl, and the kernel will
parse the first line of the script to see which interpreter to call when
the script is executed. I don't believe NT has a concept of "execute
permission" on a file, and I'd wager that the NT kernel doesn't have
a clue about the "#!/path/to/interpreter" convention on UNIX systems.
My understanding is that the Cygwin shell will parse these, but I may
be wrong about that. I'm also assuming that when htdig calls popen()
in the Cygwin library, it's the Cygwin shell that's called to run the
command. I don't know if there's anything special you need to do to
tell the Cygwin shell that this is an executable script, e.g. perhaps
a different filename extension.

If all else fails, you may want to try running Perl directly, rather than
relying on the "#!" mechanism. Try an external_parsers attribute setting
like this:

external_parsers: application/msword \
                    "/path/to/your/perl /tmp/htdig/bin/parse_doc.pl" \
                  application/postscript \
                    "/path/to/your/perl /tmp/htdig/bin/parse_doc.pl" \
                  application/pdf \
                    "/path/to/your/perl /tmp/htdig/bin/parse_doc.pl"

-- 
Gilles R. Detillieux              E-mail: <grdetil@scrc.umanitoba.ca>
Spinal Cord Research Centre       WWW:    http://www.scrc.umanitoba.ca/~grdetil
Dept. Physiology, U. of Manitoba  Phone:  (204)789-3766
Winnipeg, MB  R3E 3J7  (Canada)   Fax:    (204)789-3930
------------------------------------
To unsubscribe from the htdig mailing list, send a message to
htdig@htdig.org containing the single word "unsubscribe" in
the SUBJECT of the message.



This archive was generated by hypermail 2.0b3 on Tue Jul 13 1999 - 07:04:23 PDT