[Israel.pm] Demonizing a commanline utility
Itzik Lerner - Orpak
itzik at orpak.co.il
Tue Mar 1 03:51:18 PST 2005
I think you can do it with IPC::Open3
With this module you can open a pipe to an external process
Which in this case is your binary utility.
And you get 3 file handles for the STDIN,STDOUT and STDERR of the process
Then he remains in the 'air' all the time and you don't have to load again
my $pid = open3(\*MYOUT, \*MYIN, \*MYERR,
'some external program', 'optional argument', ...);
print MYOUT 'some input to your external program';
and so on...
From: Shlomo Yona [mailto:shlomo at cs.haifa.ac.il]
Sent: Monday, February 28, 2005 7:06 PM
To: perl at perl.org.il
Subject: [Israel.pm] Demonizing a commanline utility
I have a commanline utility that accepts input from the
standard input and then produces its output at the standard
output. So far so good.
This utility, when invoked, loads a very large data
structure into memory, an operation that takes a few
seconds, but once this data structure is loaded, the utility
produces output in a very high rate.
I would like to "deamonize" this utility so it can be loaded
once (including that expensive data structure loading) but
then accept input and produce output rapidly, without paying
the "loading" penalty every time.
This utility is a binary file that I have licensed from a
vendor. There's no way to get the sources or have the vendor
shlomo at cs.haifa.ac.il
Perl mailing list
Perl at perl.org.il
More information about the Perl