[32590] in Perl-Users-Digest
Perl-Users Digest, Issue: 3862 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 17 05:17:17 2013
Date: Thu, 17 Jan 2013 02:17:04 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 17 Jan 2013 Volume: 11 Number: 3862
Today's topics:
close_on_exec in Perl : close socket opened in parent p <chen.yack@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 17 Jan 2013 02:03:17 -0800 (PST)
From: =?UTF-8?B?6ZmI5LqR5pif?= <chen.yack@gmail.com>
Subject: close_on_exec in Perl : close socket opened in parent process when fork child , is not working
Message-Id: <e3963cbd-4b49-4abd-87be-5fa97dc7affd@googlegroups.com>
I open a socket in my main perl program,
than i execute a shell script :'/home/admin/t.sh', when i use CTRL-C to int=
errupt the perl program, i saw that the port '4444' was already openning by=
the shell script's program=E3=80=82
so=EF=BC=8Chow to close the socket fd when the `system` function was execut=
ed ?
the $^F variable is unuseful.
very thanks !
=20
1 #!/bin/env perl
2 use Linux::Inotify2;
3 use Modern::Perl;
4 use Mojo::IOLoop;
5=20
6 $^F=3D0;
7 Mojo::IOLoop->server({
8 port =3D> 4444,
9 },sub{
10 my ($stream,$chunk) =3D @_;
11 $stream->write('HTTP/1.1 200 OK');
12 print " I am server \n";
13 });
14=20
15 system('/home/admin/t.sh &>/dev/null &');
16=20
17 Mojo::IOLoop->start unless Mojo::IOLoop->is_running;
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests.
#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 V11 Issue 3862
***************************************