[11877] in Perl-Users-Digest
Perl-Users Digest, Issue: 5477 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Apr 25 06:07:26 1999
Date: Sun, 25 Apr 99 03:00:19 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 25 Apr 1999 Volume: 8 Number: 5477
Today's topics:
Re: $ENV...Explained <webmaster@eat.me.howtofoldsoup.com>
ANNOUNCE: Text-Bind-0.03 (Earl Hood)
Re: Different between recurrence and looping leonardo_azpurua@my-dejanews.com
Re: Generating a unique string for order number (Ronald J Kimball)
Help with Code <srg@babcom.com.au>
Re: Help with Code (Larry Rosler)
Re: Help: flock function (again). (Graham Ashton)
How do i print something using perl? smnayeem@my-dejanews.com
How do we create global variables in perl? <unni@wam.umd.edu>
Re: How do we create global variables in perl? <ebohlman@netcom.com>
Net FTP? in ascii or binary <gxd@bigpond.com>
Re: Net::FTP creates empty file (I R A Aggie)
Perl sources compiled using mingw32 dalekh@hotmail.com
Re: Perl sources compiled using mingw32 dalekh@hotmail.com
Re: Poker Program Help (Ronald J Kimball)
problem with $INPUT_RECORD_SEPARATOR (Kesey)
Problem with Tk under NT smnayeem@my-dejanews.com
Re: Problem with Tk under NT <thimal@my-dejanews.com>
Re: Regular Expression help (Tad McClellan)
Re: Remote access in CGI multilinks@my-dejanews.com
Re: Remote access in CGI (Matthew Bafford)
segmentation fault opening process (Kesey)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 25 Apr 1999 00:55:15 -0500
From: "HowToFoldSoup" <webmaster@eat.me.howtofoldsoup.com>
Subject: Re: $ENV...Explained
Message-Id: <7fua98$ed2$1@sys14.hou.wt.net>
I believe the people who answered the question weren't understanding the
question.
What the questioner, as I understand it, was trying to ask was if there is a
list of the $ENV{'VAR_TYPE'} type of variables that a browser automatically
passes to the perl script.
I know of the Following:
CONTENT_LENGTH
HTTP_REFERRER
REMOTE_HOST
REMOTE_ADDR
QUERY_STRING
DOCUMENT_URI
I actually came here looking for a similar list, preferably complete, is
anyone can provide one.
Thanks.
Lee Poirier
howtofoldsoup.com
------------------------------
Date: 25 Apr 1999 02:52:26 GMT
From: ehood@geneva.acs.uci.edu (Earl Hood)
Subject: ANNOUNCE: Text-Bind-0.03
Message-Id: <7fu01a$rhe@news.service.uci.edu>
Keywords: Perl, Text::Bind,
Text-Bind-0.03 is now available at CPAN. Text-Bind-0.03 is a Perl
module allowing you to bind Perl structures to text files. It allows
data sites to be defined in a file which can be bound to strings,
functions, filehandles, objects, or arrays.
Text-Bind-0.03 is available at the following locations:
<URL:http://www.oac.uci.edu/indiv/ehood/earlsperls.html>
<URL:http://www.perl.com/CPAN/authors/id/EHOOD/>
Change log for Text-Bind-0.03:
0.02 Tue Mar 30 1999
- add support data site loops
- an array can be bound to a data site
0.03 Sat Apr 24 1999
- fixed some -w warnings
--ewh
--
Earl Hood | University of California: Irvine
ehood@medusa.acs.uci.edu | Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME
------------------------------
Date: Sun, 25 Apr 1999 04:35:03 GMT
From: leonardo_azpurua@my-dejanews.com
Subject: Re: Different between recurrence and looping
Message-Id: <7fu61n$cau$1@nnrp1.dejanews.com>
In article <3720BBE6.C3DC5EAC@polyu.hknet.com>,
c8133594@comp.polyu.edu.hk wrote:
> It seen that looping can do the work of recurrence call, is there any
> different other than concept? Why do we need to study more?
>
You should study (very carefully, by the way) at least until you get a
grasp of the difference ;-)
--
Solo hay calma en la perfeccion
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sun, 25 Apr 1999 00:25:31 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Generating a unique string for order number
Message-Id: <1dqsfwh.3of6zf1v9co12N@[207.60.170.47]>
Greg McCann <gregm@well.com> wrote:
> However, this is just my development system and the final application will be
> deployed on *nix. So what I have tentatively decided on is...
>
> # generate unique order number
> my $order_time = time;
> my $order_pid = '0' x (5 - length($$)) . $$;
> my $order_no = '0' x (10 - length($order_time)) . $order_time;
> $order_no = substr($order_no, 0, 5) . '-' . substr($order_no, 5, 5) . '-' .
> $order_pid;
>
> BTW, I'm assuming that PIDs do not get larger than 5 digits - is that safe?
~> ps
PID TTY TIME CMD
1085857 ttyq2 0:01 tcsh
1061935 ttyq2 0:00 ps
~>
Probably not.
I suppose it depends on your system, though.
And I still hold that using temporary process ids as _permanent_ order
ids is conceptually wrong.
--
_ / ' _ / - aka -
( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
/ http://www.tiac.net/users/chipmunk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Sun, 25 Apr 1999 13:15:35 +1000
From: Simon Gronow <srg@babcom.com.au>
Subject: Help with Code
Message-Id: <372288D7.591A236B@babcom.com.au>
I need help with a bit of code
I have a line in a string as follows
/files/download/myfile.ext
I need it to be
\files\download\myfile.ext
My Question is how can I get one character in a line, the "/" to be
changed to "\"
Can any one help me ? If so please E-mail me at simon@babcom.com.au
Thanks
Rgds
Simon.
------------------------------
Date: Sat, 24 Apr 1999 23:41:42 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Help with Code
Message-Id: <MPG.118c58ec454b68fb989935@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <372288D7.591A236B@babcom.com.au> on Sun, 25 Apr 1999
13:15:35 +1000, Simon Gronow <srg@babcom.com.au> says...
...
> /files/download/myfile.ext
...
> \files\download\myfile.ext
>
> My Question is how can I get one character in a line, the "/" to be
> changed to "\"
>
> Can any one help me ? If so please E-mail me at simon@babcom.com.au
tr%/%\\%
'tr' (documented in perlop) is best when you are dealing with single
characters. But are you sure you want to do this? Most DOS/Windows
situations (except the dain-bread command processors) accept forward
slashes just fine.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 25 Apr 1999 09:57:21 GMT
From: billynospam@mirror.bt.co.uk (Graham Ashton)
Subject: Re: Help: flock function (again).
Message-Id: <slrn7i5po3.ohp.billynospam@wing.mirror.bt.co.uk>
In article <3721ba1b.9862759@news.skynet.co.uk>, networks@skynet.co.uk wrote:
>
>Here's part my script:
>
>open (DATAFILE, "products.txt");
>flock (DATAFILE, $lock_file);
you've not said what $lock_file is. what is it? I've got a sneaky suspicion
it's not what it should be.
do this instead;
use Fcntl qw(:flock); # imports locking constants
open(DATAFILE, "products.txt") or die "open: $!";
flock(DATAFILE, LOCK_SH) or die "LOCK_SH: $!";
# use the file here
close(DATAFILE); # i.e. don't bother unlocking it
# because that creates a race
# condition
Read up on what the constants that you import with the Fcntl module do.
The one I used above (LOCK_SH) is for shared locks. Shared locks allow
multiple processes to read, but nothing can write while the shared lock
is in effect.
--
Graham
- billynospam@mirror *is* a deliverable address
------------------------------
Date: Sun, 25 Apr 1999 08:04:02 GMT
From: smnayeem@my-dejanews.com
Subject: How do i print something using perl?
Message-Id: <7fui9h$mlu$1@nnrp1.dejanews.com>
Does anyone know how i can direct the output of print statements to the
printer?
smnayeem
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sun, 25 Apr 1999 02:03:18 -0400
From: Ted Unnikumaran <unni@wam.umd.edu>
Subject: How do we create global variables in perl?
Message-Id: <3722B025.7AC5002E@wam.umd.edu>
Hello, i'm just beginning to learn perl, so I apologize if this is a
stupid question.
I want to know how I can use global variables in perl. I've heard that
environmental variables are basically global variables, but that doesn't
seem to work properly for me.
This is basically what i want to do.
When someone enters my web page, i want them to enter a user id and
other information about themselves. They then press the submit button
and that information gets passed to some .cgi file, say 1st.cgi. This
1st.cgi file will then create another web page, where the user will
enter even more information about themselves, and press another submit
button. This second submit button wil call another .cgi file, lets call
it 2nd.cgi and its at this page that I am having problems. How can I
access the information entered into the first web page and passed into
1st.cgi from this 2nd.cgi file?
What if I want to access the information from the first web page from a
.cgi file that i call real late in the process, say 5th.cgi, how will I
be able to do that?
Another question that I have that might be related, is how can I call
another cgi file from one cgi file. So far the only way I know how to
call a cgi file is if a user presses a submit button, or if a user
presses on a link. But how can I call a cgi file from within another
file?
I'm sorry if I confused you, you can e-mail me if you want more
details. And any tips would be greatly appreciated.
thanks
Ted
------------------------------
Date: Sun, 25 Apr 1999 09:43:19 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: How do we create global variables in perl?
Message-Id: <ebohlmanFAqoC7.J68@netcom.com>
Ted Unnikumaran <unni@wam.umd.edu> wrote:
: Hello, i'm just beginning to learn perl, so I apologize if this is a
: stupid question.
Not stupid, but misphrased and misdirected.
: I want to know how I can use global variables in perl. I've heard that
: environmental variables are basically global variables, but that doesn't
: seem to work properly for me.
: This is basically what i want to do.
: When someone enters my web page, i want them to enter a user id and
: other information about themselves. They then press the submit button
: and that information gets passed to some .cgi file, say 1st.cgi. This
: 1st.cgi file will then create another web page, where the user will
: enter even more information about themselves, and press another submit
: button. This second submit button wil call another .cgi file, lets call
: it 2nd.cgi and its at this page that I am having problems. How can I
: access the information entered into the first web page and passed into
: 1st.cgi from this 2nd.cgi file?
Your real question isn't "how do I use global variables in Perl" (which
means something else entirely and the simple answer is "very sparingly"),
it's "how do I maintain state across CGI sessions in Perl" and the simple
answer is "the same way you would in any language." Therefore, it's not
a Perl question, it's a CGI question of the sort dealt with in
comp.infosystems.www.authoring.cgi and is, I believe, covered in that
group's FAQ (there are several ways to do it).
------------------------------
Date: Sun, 25 Apr 1999 18:48:57 +0930
From: "Dave Johnson" <gxd@bigpond.com>
Subject: Net FTP? in ascii or binary
Message-Id: <CfAU2.2343$116.3002@news2.ozemail.com.au>
Im using Net FTP to transfer files from one server to another.
The files needed to be transferred are both ASCII and BINARY...
I noticed some problems with the files that needed to be transferred by
binary and was wondering how the transer is done, and what command do I need
to define the way it should be transferred if I want it to be transferred
via Binary?
Thanks for your help
Dave Johnson.
------------------------------
Date: 25 Apr 1999 04:54:42 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Net::FTP creates empty file
Message-Id: <slrn7i585e.i86.fl_aggie@stat.fsu.edu>
On Sun, 25 Apr 1999 01:47:30 +0100, Wayne Keenan
<tripix@tdi-net.freeserve.co.uk>, in <7ftp7o$8bv$1@news4.svr.pol.co.uk> wrote:
+ my $ftp = Net::FTP->new($remoteHost, -TIMEOUT => 10) || die "Failed to
+ connect to $remoteHost. $!";
Have you turned on the internal Net::FTP debugging?
#for debuging: $ftp = Net::FTP->new($server,"Debug",10);
is what my notes have.
James
------------------------------
Date: Sun, 25 Apr 1999 04:56:15 GMT
From: dalekh@hotmail.com
Subject: Perl sources compiled using mingw32
Message-Id: <37229fec.26968618@news.flash.net>
Has anyone been successful compiling the latest sources using
egcs1.1.2/mingw32? I have winNTv4
dalekh@hotmail.com
------------------------------
Date: Sun, 25 Apr 1999 05:05:52 GMT
From: dalekh@hotmail.com
Subject: Re: Perl sources compiled using mingw32
Message-Id: <3722a1ff.27500263@news.flash.net>
Oh, my problem is when it tries to compile /ext/Sockets.
The error is /lib/CORE/config.h
CORE should be the gcc-lib/egcs... directory. I think it is
supposed to COREDIR so there might be a bug.
Anty help appreciated.
------------------------------
Date: Sun, 25 Apr 1999 00:25:32 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Poker Program Help
Message-Id: <1dqshw1.sfd4fs1pgcpqtN@[207.60.170.47]>
Jarhead0 <jarhead0@rochester.rr.com> wrote:
> I would love to hear any advice on how to rank hands for a game of seven
> card stud. I have all the cards sorted by name, suit, and value, but cant
> seem to come up with a good method of determaning which hand is the best. I
> have it working fine for 5 card, but 7 is kicking my butt!
Since you know how to rank a 5 card hand, rank all possible 5 card
subsets of the 7 card hand. Now you've got the best possible rank for
that 7 card hand, which you can compare to the ranks of the other 7 card
hands.
7 choose 5 is 21, so it shouldn't even be too much work to do.
--
_ / ' _ / - aka -
( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
/ http://www.tiac.net/users/chipmunk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 25 Apr 1999 07:21:36 GMT
From: kesey@globe.ece.utexas.edu (Kesey)
Subject: problem with $INPUT_RECORD_SEPARATOR
Message-Id: <KESEY.99Apr25022136@globe.ece.utexas.edu>
I noticed some peculiar behavior when I was manipulating the
$INPUT_RECORD_SEPARATOR, or $/ variable. Take a look at the following
script:
------------------------------------------------------------
#!/usr/local/bin/perl5.005
$SIG{ALRM} = \&changeInpRecSep;
alarm (5);
while (<>)
{
for (split /^/m)
{
print "read $_\n";
}
}
sub changeInpRecSep
{
print "changeInpRecSep called\n";
$oldInputRecSep = $/;
$/ = $oldInputRecSep;
alarm (5);
}
------------------------------------------------------------
My perl version is
This is perl, version 5.005_02 built for sun4-solaris
When I run the script on my system, I have the following I/O:
changeInpRecSep called
a
changeInpRecSep called
changeInpRecSep called
b
changeInpRecSep called
c
read a
read b
read c
The lines with only a single character (a, b, or c) are my input. I
typed a <ENTER>, b <ENTER>, c <ENTER>. Notice that changeInpRecSep()
is called every 5 seconds, so there's a lot of time between when I
entered a, b, and c. But look how long it took my input to be
recognized. Finally when I typed c, all the input was recognized. By
chance I timed the typing of c <ENTER> just right, and all the input
was recognized.
Clearly this has something to do with what I'm doing to $/. However,
I never even change $/ in the alarm handler. Perhaps the line $/ =
$oldInputRecSep changes it very briefly? But I'd think that that
instruction would finish executing before my input was processed. Or
maybe not. Surely keyboard events are handled by interrupt handlers,
which would even interrupt that line in the middle of its execution.
So is this considered normal behavior?
-John
------------------------------
Date: Sun, 25 Apr 1999 08:48:53 GMT
From: smnayeem@my-dejanews.com
Subject: Problem with Tk under NT
Message-Id: <7fuktl$og1$1@nnrp1.dejanews.com>
where do i get information on tk under ActivePerl for NT. There are the
documentation but how do i like _program_ using the tk modules? i cant seem to
be able to make a head or a tail out of this... everywhere its bout tk for
unix-based perl where theres also tcl, but i only have tk and what might i do?
:0(
smnayeem
smnayeem@agni.com
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sun, 25 Apr 1999 09:13:10 GMT
From: Thimal <thimal@my-dejanews.com>
Subject: Re: Problem with Tk under NT
Message-Id: <7fumb6$plg$1@nnrp1.dejanews.com>
smnayeem@my-dejanews.com wrote:
> where do i get information on tk under ActivePerl for NT.
The way that I learnt (and am still learning), is by running the demos for
Tk. Just type "widget" at the command line, and you can see lots of stuff
done with Tk...and view source And there is also comprehensive Tk HTML help
installed when you install Tk modules... just consult them...
>There are the
> documentation but how do i like _program_ using the tk modules?
like I said, type widget, look at the code samples, and that should be all
that is required....
> be able to make a head or a tail out of this... everywhere its bout tk for
> unix-based perl where theres also tcl, but i only have tk and what might i do?
Actually, there shouldn't be a lot of difference between the Perl/Tk for Unix
and Perl/Tk for Win32.... but still, I can do most things that I want now with
Tk, and I didn't need anything much more than what I mentioned (other than
reading through the newsgroups, and a few frantic plead sessions at the start
:o)
There is also a book called Learning Perl/Tk (I've not read it yet, so can't
tell you what it's like), by O'Reillys (who else ? ;o), which might be of use
to you.... perhaps you need to grab a copy...
HTH
Thimal
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sat, 24 Apr 1999 15:53:49 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Regular Expression help
Message-Id: <dg7tf7.fo.ln@magna.metronet.com>
ham@nospam.com wrote:
: I have a string in a key-value format.
: key=value,key=value,key=value (no comma at the end)
: I'd like to extract just the data before the = sign (key).
: Data after the = sign can contain just about any character, including
: the following:
: ; : - _ / \ \s
All that really matters is that = and , do not appear
in keys or values.
: I'm having some trouble getting the regex pattern to work. Any help
: would be appreciated. Thanks.
my @keys = /([^=]+)=[^,]*,?/g; # list of keys
or, if you want to put it into a real hash:
my %hash = /([^=]+)=([^,]*),?/g; # list of alternating keys and values
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 25 Apr 1999 03:16:15 GMT
From: multilinks@my-dejanews.com
Subject: Re: Remote access in CGI
Message-Id: <7fu1dt$8kn$1@nnrp1.dejanews.com>
In article <7ftit2$3kv$1@gellyfish.btinternet.com>,
Jonathan Stowe <gellyfish@gellyfish.com> wrote:
> On Sat, 24 Apr 1999 22:24:58 GMT multilinks@my-dejanews.com wrote:
> >
> > So I have no sure way to identify who is accessing my web site from a
browser
> > and who is using a script to access my script from another server.
> >
>
> Unless something eludes me here there is no difference.
>
> /J\
> --
> Jonathan Stowe <jns@gellyfish.com>
> Some of your questions answered:
> <URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
> Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
>
If there is a way to determine that someone is using a browser or WebTV to
access my script, I can make the distintion that I seek. Are you saying there
is no difference and thus no way to do this?
Vladimir
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sun, 25 Apr 1999 04:06:35 GMT
From: dragons@dragons.duesouth.net (Matthew Bafford)
Subject: Re: Remote access in CGI
Message-Id: <slrn7i53hl.1m7.dragons@dragons.duesouth.net>
On Sun, 25 Apr 1999 03:16:15 GMT, multilinks@my-dejanews.com <multilinks@my-dejanews.com>
lucked upon a computer, and thus typed in the following:
: In article <7ftit2$3kv$1@gellyfish.btinternet.com>,
: Jonathan Stowe <gellyfish@gellyfish.com> wrote:
: > On Sat, 24 Apr 1999 22:24:58 GMT multilinks@my-dejanews.com wrote:
: > > So I have no sure way to identify who is accessing my web site from a
: > > browser and who is using a script to access my script from another server.
: >
: > Unless something eludes me here there is no difference.
:
: If there is a way to determine that someone is using a browser or WebTV to
: access my script, I can make the distintion that I seek. Are you saying there
: is no difference and thus no way to do this?
Not only is there no difference, there's no way to do it 100% of the
time. It is extremly easy (we're talking 10 lines or so) to write a Perl
script that will act exactly like MSIEx.
If you really want to tell the difference from, say, Netscape and WebTV,
why not just see what each of them does?
: Vladimir
--Matthew
------------------------------
Date: 25 Apr 1999 03:24:04 GMT
From: kesey@globe.ece.utexas.edu (Kesey)
Subject: segmentation fault opening process
Message-Id: <KESEY.99Apr24222404@globe.ece.utexas.edu>
I've included two scripts here. When the one opens the other under
these circumstances, a segmentation fault is produced.
-- file slowScript.pl ----------------------------------------
#!/usr/local/bin/perl5.005
sleep 10;
-- end slowScript.pl ----------------------------------------
-- file openSegV.pl ------------------------------------------
#!/usr/local/bin/perl5.005
print "perl version $]\n\n";
$SIG{ALRM} = \&timedOut;
print "CALL 1\n";
&openSlowScript ();
print "CALL 2\n";
&openSlowScript ();
sub timedOut
{
die "GOT TIRED OF WAITING";
}
sub openSlowScript
{
my $pid;
eval
{
print "about to open\n";
($pid = open SLOW, '| slowScript.pl') or warn "slowScript.pl: $!";
print "done with open\n";
if ($pid)
{
alarm (1);
close SLOW;
}
};
if ($@ =~ /GOT TIRED OF WAITING/)
{
print "Timed out\n";
# kill 'KILL', $pid;
# close SLOW;
}
print "exiting openSlowScript\n";
$execOutput;
}
-- end openSeg.pl --------------------------------------------
Running this on my system, running Solaris 5.5.1, produces the
following output:
perl version 5.00502
CALL 1
about to open
done with open
Timed out
exiting openSlowScript
CALL 2
about to open
Segmentation fault (core dumped)
So it seems to have the segmentation fault at the open statement. By
changing the alarm to more than 10, the time it takes slowScript.pl to
run, I can eliminate the segmentation fault. I tried running it under
perl -d, but the fault didn't occur then. Also, if I put the
commented out close SLOW line back, the segmentation fault occurs at
the close and gives the following output:
perl version 5.00502
CALL 1
about to open
done with open
Timed out
Segmentation fault (core dumped)
I'm sure that I'm not using the right method in this test script, but
I shouldn't get a segmentation fault.
Maybe while people are looking at this script, they can give me some
advice on how to handle my situation. In reality, of course, I'm not
opening slowScript.pl. I'm opening a binary executable for which I
have no source code. Under certain conditions, this executable hangs.
So I need the time out to detect that it has hung. At first I was
using backticks to run the executable, like:
my $result = `echo $command | binExecutable`;
But then when binExecutable hung, it would leave those processes
around. I wanted to clean up, so I used open so I'd have the process
ID and could kill the process. However, the kill never actually
killed the process. I was always left with a <defunct> process. I'm
guessing this process never exits because it still has a pipe
connected to it. I've never known what those <defunct> processes are,
but they can't be good to have around.
The other problem I had, although I can't reproduce it with these test
scripts, occurred when I tried to clean up a bit by closing the
filehandle after the time out, like I do here with 'close SLOW'. But
I found that then my script would hang on that line, apparently
waiting for the binExecutable to finish (which it never did).
Can anyone give me advice on how to deal with this situation cleanly?
Thanks in advance,
John
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 5477
**************************************