[16026] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 3438 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 21 06:10:28 2000

Date: Wed, 21 Jun 2000 03:10:16 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <961582216-v9-i3438@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 21 Jun 2000     Volume: 9 Number: 3438

Today's topics:
    Re: Perl Builder 2.0 for LINUX - Beta Available (Bart Lateur)
    Re: Perl Timer help <abe@ztreet.demon.nl>
    Re: Perl Tutorials <damonNOdaSPAM@unispace.com.invalid>
        Problem with sockets fgont@my-deja.com
    Re: Problems with IIS (for a change) - DBD::CSV::st - m <guy@firstcreative.com>
    Re: question about cookie? nobull@mail.com
    Re: Reg Expression Question <elhber1@mail.lido-tech>
    Re: Reg Expression Question <elhber1@mail.lido-tech>
        Simple brain picker <sushi38@my-deja.com>
    Re: Simple brain picker (Bart Lateur)
        Simple Question <mxusstmm@xoommail.com>
        Simple Question <mxusstmm@xoommail.com>
    Re: socket help <gellyfish@gellyfish.com>
    Re: sourcing bash script w/ Perl? (Brandon Metcalf)
    Re: SUCCESS! (map sort map question) Was:Sorting a ':'  <abe@ztreet.demon.nl>
        SUCCESS! (map sort map question) Was:Sorting a ':' deli <jimmy.lantz@ostas.lu.se>
        Truly bizarre do FILE behavior (Sean McAfee)
    Re: UNIX Mail -> Firewall -> Web? <gellyfish@gellyfish.com>
    Re: Urgent help with non-blocking child process require (Joe Smith)
    Re: Viewing Multipart/Mixed messages <gellyfish@gellyfish.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Wed, 21 Jun 2000 09:17:38 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Perl Builder 2.0 for LINUX - Beta Available
Message-Id: <39548800.1426841@news.skynet.be>

Mark W. Schumann wrote:

>I'm not the original griper, but you're missing the point.
>
>If I'm a Perl programmer who uses Linux, and I want to use your Perl
>IDE on Linux, I have to install and configure some completely unrelated
>bit of software to do it.

I agree.

A better slogan would have been:

	"Perl Builder now works under Windows emulation on Linux!"

which isn't a very impressive slogan at all.

-- 
	Bart.


------------------------------

Date: Wed, 21 Jun 2000 10:50:12 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: Perl Timer help
Message-Id: <j0pvkscsr6plaih7k4d627j8ek55ggluoc@4ax.com>

On Tue, 20 Jun 2000 19:34:48 GMT, felrodian@my-deja.com wrote:

> 
> 
> > I don't understand what it is supposed to do but that will definitely
> > get into an infinite loop.
> Yes! An infinite loop.. that's what I want. I want an infinite loop that
> will run a subroutine every x seconds or x minutes. Any suggestions
> greatly appreciated.

I'd suggest you use a scheduling mechanism that probably is on your
system already.

-- 
Good luck,
Abe


------------------------------

Date: Tue, 20 Jun 2000 23:39:00 -0700
From: damonr <damonNOdaSPAM@unispace.com.invalid>
Subject: Re: Perl Tutorials
Message-Id: <22eee3f8.569b502d@usw-ex0106-045.remarq.com>

Hehe..sorry about the typos...the url is
http://www.devcritic.com and same should be "say"

Got questions?  Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com



------------------------------

Date: Wed, 21 Jun 2000 07:14:15 GMT
From: fgont@my-deja.com
Subject: Problem with sockets
Message-Id: <8ipq00$kib$1@nnrp1.deja.com>

Hi!

I've made some cliente/server applications using perl, and have found the
following problem:

If I send some data from the client to the server, and this data does not end
with a newline (\n), the server can't get it.

That means, suppose I have a NSOCK socket at the client, and I make a:

print NSOCK "Hello, World!";

Well, the server will not get this data (actually, the data is *really* sent,
but when I try to read() it, I don't anything).

But if I make a:

print NSOCK "Hello, World!\n";
# Please note that it contains a newline

This data IS GOT by the server (that means, if I try to read() it at the
server, I get it)


And I made another test: I tried to send a fairly "big" amount of data (say
2000 bytes) to a tcp server. And whether the string had a newline or not, the
client got the data.


It seems that you can only read() the data if it's finished by a newline
(\n), or if it's a "big" amount of data.


I say that the data is really sent (and that the problem should be at the
program that tries to read it), as I used tcpdump, to see the packets that go
through my Network card...  (anyway, I tested it with the loopbak, and it
didn't work, either)

I tried to use while(<SOCKET>) and recv() to get the data, but the problem
continues.

I made the same program using C language, and the problem does not appear. So
that I don't know if Perl configures some option of the sockets so that they
behave like this, or what...


Here's a tcp server with which you can test what I'm explaining. (If you want
the tcp client, feel free to ask it to me...)


----- cut here -----
#!/usr/local/bin/perl
##############################################################
# TCP server
##############################################################
$port= 2345;

$AF_INET=2;
$SOCK_STREAM=1;
$sockaddr = 'S n a4 x8';

($name, $aliases, $proto) = getprotobyname('tcp');

print "Port = $port\n";

$this = pack($sockaddr, $AF_INET, $port, "\0\0\0\0");
socket(S, $AF_INET, $SOCK_STREAM, $proto) || die "socket: $!";
bind(S, $this) || die "bind: $!";
listen(S, 1) || die "connect: $!";

print "Listening for connection....\n";

($addr = accept(NS, S)) || die $!;
print "accept ok\n";

($af, $port, $inaddr) = unpack($sockaddr, $addr);
@inaddr = unpack ('C4', $inaddr);
$ip = "@inaddr[0].@inaddr[1].@inaddr[2].@inaddr[3]";
print "$af $port @inaddr\n";


for( ; ;){
	read(NS, $entrada, 1);
	print $entrada;
}

close(NS);

----- cut here -----


Best regards,

Fernando Ariel Gont
e-mail: fgont [at] softhome [dot] net



Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Wed, 21 Jun 2000 10:45:36 +0100
From: "Guy Fraser" <guy@firstcreative.com>
Subject: Re: Problems with IIS (for a change) - DBD::CSV::st - more info
Message-Id: <8iq2s0$j1k$1@plutonium.compulink.co.uk>

Hi.

More info on problem below...

I've traced the problem so far to this bit of code:

    if ($file !~ /^$open_table_re/o) {
 $file = $haveFileSpec ?
     File::Spec->catfile($data->{Database}->{'f_dir'}, $table)
  : $data->{Database}->{'f_dir'} . "/$table";
    }

The command that is generating the gibberish is:

File::Spec->catfile($data->{Database}->{'f_dir'}, $table)

Before this, the value for $file is "c:/Inetpub/wwwroot/cgi-bin/glossary"
but after this command it gets turned in to
"C:\Inetpub\wwwroot\cgi-bin\glossary\c:/Inetpub/wwwroot/cgi-bin/glossary".
I've still not been able to find a reference doc for catfile so don't know
what exatly this command is trying to do yet...

Current Error message (caused by above):

> DBD::CSV::st execute failed: Cannot open
> C:\Inetpub\wwwroot\cgi-bin\glossary\c:/Inetpub/wwwroot/cgi-bin/glossary:
> Invalid argument at C:/Perl/site/lib/DBD/File.pm line 469.





------------------------------

Date: 21 Jun 2000 09:49:14 +0100
From: nobull@mail.com
Subject: Re: question about cookie?
Message-Id: <u9og4vxvud.fsf@wcl-l.bham.ac.uk>

"JL" <ltlau@yahoo.com> writes:

> I would like to ask about what is "expires" use for in the cookie?

In that case perhaps you should try another newsgroup.  This newsgroup
is for matters relating to Perl.  You need one where matters relating
to HTTP are discussed.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


------------------------------

Date: Wed, 21 Jun 2000 08:03:44 GMT
From: Bernard El-Hagin <elhber1@mail.lido-tech>
Subject: Re: Reg Expression Question
Message-Id: <395075D9.610BFC3A@mail.lido-tech>

Tina Mueller wrote:
> 
> hi,
> 
> Tad McClellan <tadmc@metronet.com> wrote:
> > On Tue, 20 Jun 2000 02:37:40 GMT, tony_123@my-deja.com <tony_123@my-deja.com> wrote:
> 
> >>I have the string
> >>
> >>$MyString='<img src="http://www.myhouse.com.au/house.gif">';
> >>
> >>Can someone please tell me how I can extract the house.gif part of this
> >>string.
> 
> > Here's one way:
> >    my $img_name = substr($MyString, 36, 9);
> 
> i like that one, but how about that:
> ($gif) = ($MyString =~ m/(house\.gif)/);

Let the anti-golf begin:

($gif) = ($MyString =~
m/....\s...............\........\....\....house\.gif../);

:-)

--
Cheers,
Bernard


------------------------------

Date: Wed, 21 Jun 2000 08:07:18 GMT
From: Bernard El-Hagin <elhber1@mail.lido-tech>
Subject: Re: Reg Expression Question
Message-Id: <395076B0.7F04F022@mail.lido-tech>

Tina Mueller wrote:
> 
> hi,
> 
> Tad McClellan <tadmc@metronet.com> wrote:
> > On Tue, 20 Jun 2000 02:37:40 GMT, tony_123@my-deja.com <tony_123@my-deja.com> wrote:
> 
> >>I have the string
> >>
> >>$MyString='<img src="http://www.myhouse.com.au/house.gif">';
> >>
> >>Can someone please tell me how I can extract the house.gif part of this
> >>string.
> 
> > Here's one way:
> >    my $img_name = substr($MyString, 36, 9);
> 
> i like that one, but how about that:
> ($gif) = ($MyString =~ m/(house\.gif)/);

Let the anti-golf begin:

($gif) = ($MyString =~
m/....\s...........\....\........\....\....(house\.gif)../);

:-)

--
Cheers,
Bernard


------------------------------

Date: Wed, 21 Jun 2000 04:46:24 GMT
From: Igor Mack <sushi38@my-deja.com>
Subject: Simple brain picker
Message-Id: <8iphau$eum$1@nnrp1.deja.com>

What is the most proper way of doing this:

$first_five = substr($serialno, 3, 3);
$version = substr($first_five, 0, 1) . "." . substr($first_five, 1, 2) ;

Thanks.

--
Igor Mack.


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Wed, 21 Jun 2000 09:14:48 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Simple brain picker
Message-Id: <3953868a.1053296@news.skynet.be>

Igor Mack wrote:

>What is the most proper way of doing this:
>
>$first_five = substr($serialno, 3, 3);
>$version = substr($first_five, 0, 1) . "." . substr($first_five, 1, 2) ;

	$first_three = substr($serialno, 3, 3);
	substr($first_three, 1, 0) = "."; 

(where did you get that idea of "first five"?)

-- 
	Bart.


------------------------------

Date: Tue, 20 Jun 2000 04:36:55 -0700
From: "mxusstmm" <mxusstmm@xoommail.com>
Subject: Simple Question
Message-Id: <re%35.996$73.7240@news1.tor.primus.ca>

Just picked up PERL so help would be appriciated with this question.
I just finished PC magazine's PERL 5.0 CGI Web Pages book.

Here's my problem:

I uploaded my PERL scripts to my ISP.
I followed all of thier directions regaring cgi file location and the
#!usr/bin/perl line, but...

When I use the GET method to call the pl file, I just see the whole script
in the browser like unformatted text.When I use POST from a form, my browser
wants to download.

I've tried to duplicate the error on my server, by turing off access to
PERL, but I just get 404 errors.
Can't seem to duplicate whats going on online.

I'm running O'Reily's WebSite server on an NT box to test the stuff, but my
ISP uses ZEUS on Sun boxes.

Has anyone had this set of problems happen to them?
Is this my problem or my ISP?






------------------------------

Date: Wed, 21 Jun 2000 04:41:27 -0700
From: "mxusstmm" <mxusstmm@xoommail.com>
Subject: Simple Question
Message-Id: <Ki%35.997$73.9568@news1.tor.primus.ca>

Sorry about the double post, My clock was set back.
Didn;t want to get lost in the crowd of yesterday.


Just picked up PERL so help would be appriciated with this question.
I just finished PC magazine's PERL 5.0 CGI Web Pages book.

Here's my problem:

I uploaded my PERL scripts to my ISP.
I followed all of thier directions regaring cgi file location and the
#!usr/bin/perl line, but...

When I use the GET method to call the pl file, I just see the whole script
in the browser like unformatted text.When I use POST from a form, my browser
wants to download.

I've tried to duplicate the error on my server, by turing off access to
PERL, but I just get 404 errors.
Can't seem to duplicate whats going on online.

I'm running O'Reily's WebSite server on an NT box to test the stuff, but my
ISP uses ZEUS on Sun boxes.

Has anyone had this set of problems happen to them?
Is this my problem or my ISP?








------------------------------

Date: 21 Jun 2000 09:15:06 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: socket help
Message-Id: <8iptia$fum$1@orpheus.gellyfish.com>

On Tue, 20 Jun 2000 06:07:55 -0700 blogan@chipotle.org wrote:
> I would like a client written in PERL to communicate via sockets to a
> server written in C. I have two pairs of client/server programs, one 
> in C and one in PERL. The PERL cleint/server can talk to each other as
> can the C client/server. But, the PERL client cannot establish a socket
> with the C server, nor can the c client talk to the PERL server.
> 
> Will someone please look at the client and server code and give me some
> help with what needs to be done to get them communicating with each
> other? The OS is Linux.
> 
> An Email would also be appriciated.
> 

I could always sign you up for the Daphne and Celeste fanclub mailing list.

> 
> client.pl
> #!/usr/bin/perl

                 ^ surely something missing here .

> #create socket connection to server    
> use IO::Socket;
> my $sock = new IO::Socket::INET (
>    PeerAddr => localhost,

                 ^        ^  missing quotes here.
>    PeerPort => 9736,
>    Proto => 'tcp',
>   );
> 

If you have questions about your C program then you should ask in an
appropriate newsgroup.
-- 
** This space reserved for venue sponsor for yapc::Europe **
              <http://www.yapc.org/Europe/> 


------------------------------

Date: 21 Jun 2000 03:50:07 GMT
From: bmetcalf@baynetworks.com (Brandon Metcalf)
Subject: Re: sourcing bash script w/ Perl?
Message-Id: <8ipe1f$fp6$1@bcrkh13.ca.nortel.com>

rootbeer@redcat.com writes:

 > On 21 Jun 2000, Peter Bismuti wrote:
 > 
 > > I have a bash script that sets environment variables, I'd like
 > > to call it within a Perl script so that Perl sees these variables.
 > 
 > This comes up every month. :-P  Not your fault; I don't see it directly
 > addressed in the FAQs. Or the Perl Cookbook, either.
 > 
 > > I tried execiting something like:
 > > 
 > > 	system("source bashscript.sh");
 > 
 > Yes; that does the work in a subprocess; it doesn't change the values in
 > your Perl process.

No, that doesn't work in the subprocess.  There is no such command as
source.  It's a csh builtin and perl doesn't use csh when system() is
called.

Brandon


------------------------------

Date: Wed, 21 Jun 2000 11:57:54 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: SUCCESS! (map sort map question) Was:Sorting a ':' delimeted file by a    field value/surname.
Message-Id: <0b21lsgge7i4e785qormd9u10i3q956fsj@4ax.com>

On Wed, 21 Jun 2000 10:40:33 +0200, Jimmy Lantz
<jimmy.lantz@ostas.lu.se> wrote:

> SUCCESS!
> Hi,
> now I finally made it.
> I got a script(see code below) to sort the file thanks to the
> Schwartzian Tranform.
> It just seems to give my server a heavy workload is this normal ?
> Is there ways I can optimize it.
> Usually the file is between 50-100 lines long.
> But I had to increase my memory in Macperl to get it to work else I got
> an Out of memory! response.
> 
> Thanks all of you for contribuating with your views and ideas.
> Yours sincerely
> Jimmy Lantz	
> 
> ##################################################
> 
> #!/usr/bin/perl

	#!/usr/bin/perl -w
	use strict;

This would be a good start, to make shure to let perl help you find
mistakes.

> 
> $fil = 'some_file';
> 
> &read_file("$fil");

The read_file sub doesn't seem to read the file, but just opens it.
There is no real need to test for existence. If open() fails, the '$!'
variable should tell you the reason.

	open DATA, $fil or die "Can't open '$fil': $!";

Should be enough. If you want the errors reported in your browser, you
can put this in your program (as it seems to be CGI. If not, just ignore
this):

	use CGI::Carp 'fatalsToBrowser';

> 
 ...
> 
> foreach $specliner (@sorted_record) {
>     push(@records, new_record($specliner));
>  }

From the code you show, you don't seem to do anything special, apart
from printing, with that extra 'copy' of the original data in the larger
structure of an array of hashes. 

You could also do:
	foreach my $specliner (@sorted_record) {
		my $row = new_record($specliner);
		print	"Namn: $row->{fnamn} $row->{enamn}\n",
			"Epost:  $row->{epost}\n";
	}

This way each original record (in string form, ':' separeted) will only
be expanded to a hash, when you need it.

I changed the print() a little, to use interpolation and the
'arrow-notation' to dereference the hash-ref. That way it looks cleaner
to me.

>  sub new_record {
> my($line) = @_ ;
>     my @fields = split /:/, $line;
> 
>     my %record = (
>        kurskod  => $fields[0],
>        pnr => $fields[1],
>        fnamn    => $fields[2],
>        enamn    => $fields[3],
>        epost   => $fields[4],
>        telnr   => $fields[5],
>        padress  => $fields[6]);
> 	postnr    => $fields[7],
>        ort    => $fields[8],
>        studietyp   => $fields[9],
>        tentaresultat   => $fields[10],
>     return \%record;
>  }
You could use a hash slice to make this look cleaner:

	sub new_record {
		my($line) = @_;
		my %record;
		@record{ qw(kurskod pnr fnamn enamn epost telnr 
			padress postnr ort studietyp tentaresultat) } =
				split /:/, $line;
		return \%record;
	}

-- 
Good luck,
Abe


------------------------------

Date: Wed, 21 Jun 2000 10:40:33 +0200
From: Jimmy Lantz <jimmy.lantz@ostas.lu.se>
To: Forum Macperl <macperl-forum@macperl.org>
Subject: SUCCESS! (map sort map question) Was:Sorting a ':' delimeted file by a  field value/surname.
Message-Id: <39507F81.57C06CC2@ostas.lu.se>

SUCCESS!
Hi,
now I finally made it.
I got a script(see code below) to sort the file thanks to the
Schwartzian Tranform.
It just seems to give my server a heavy workload is this normal ?
Is there ways I can optimize it.
Usually the file is between 50-100 lines long.
But I had to increase my memory in Macperl to get it to work else I got
an Out of memory! response.

Thanks all of you for contribuating with your views and ideas.
Yours sincerely
Jimmy Lantz	

##################################################

#!/usr/bin/perl

$fil = 'some_file';

&read_file("$fil");

 @sorted_record = map {$_->[0]} # keep only the line itself for printing
        sort { # sort on the two fields you selected below
                $a->[1] cmp $b->[1] ||
                $a->[2] cmp $b->[2]
        }
        map { [ $_, (split(/:/))[3,2] ] } # keep the line itself
                                          # + fields 3 and 2 for sorting
                                          # (field numbers start at 0)
        <DATA>; 
close(DATA);

foreach $specliner (@sorted_record) {
    push(@records, new_record($specliner));
 }



#############
my $row;
 foreach $row (@records) {
    print "Namn: ",
     ${$row}{'fnamn'}, 
	" ", 
	${$row}{'enamn'},
     "\n",
	"Epost: ",
   	" ",
     ${$row}{'epost'},
     "\n";
 }
 exit;

############################
 sub new_record {
my($line) = @_ ;
    my @fields = split /:/, $line;

    my %record = (
       kurskod  => $fields[0],
       pnr => $fields[1],
       fnamn    => $fields[2],
       enamn    => $fields[3],
       epost   => $fields[4],
       telnr   => $fields[5],
       padress  => $fields[6]);
	postnr    => $fields[7],
       ort    => $fields[8],
       studietyp   => $fields[9],
       tentaresultat   => $fields[10],
    return \%record;
 }


########## Läser in den angivna filen till  ########

sub read_file
{
my($specfil) = @_ ;
if (-e "$specfil")
{
open(DATA, "<$specfil") or die "cannot read file";
}
else 
{
print "Content-type: text/html\n\n";
print"The file $specfil is missing";
exit;
}

}


------------------------------

Date: Wed, 21 Jun 2000 07:23:36 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Truly bizarre do FILE behavior
Message-Id: <Y3_35.135$GA3.2575@news.itd.umich.edu>

I encountered this incredibly anomalous behavior recently in the do FILE
command.  It appears to have been fixed in 5.6, but prior versions are
still widespread enough that I thought I'd post a description.

First I created a file called "do-file" containing the single line
"$var = 987".  When executed with "do", it should set the global variable
$var in whatever package is active at the time "do" is called.

Then I created a file called "test-do":

----------------------------------------------------------------------
$main::var = $User::var = 0;
{ package User; do "do-file" }
print "\$main::var = $main::var; \$User::var = $User::var\n";

sub subroutine { package User; do "do-file" }

$main::var = $User::var = 0;
subroutine();
print "\$main::var = $main::var; \$User::var = $User::var\n";

my $var; print "my \$var = $var\n";
----------------------------------------------------------------------

When I run this code with 5.005_03, I get the following output:

$main::var = 0; $User::var = 987
$main::var = 0; $User::var = 0
my $var = 987

This shows that the "$var = 987" from the file "do-file" is being applied
to the lexical variable $var: something the documentation explicitly says
do() cannot do!  This happens even though the lexical variable is declared
*after* the calls to do()...but *only* if do() is called from within a
subroutine!  Extremely strange.

There are some other odd occurrences of behavior like this, such as the
fact that

my $success = do { package User; do "do-file" };

 ...displays the bug described above, but:

my $success; { package User; $success = do "do-file" }

 ...does not.  At least, not all of the time.  Since the bug has been fixed
in 5.6, I won't spend any more time banging my head against the problem.
Still, those of you using earlier versions of Perl (like myself) should
beware.



------------------------------

Date: 21 Jun 2000 08:37:07 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: UNIX Mail -> Firewall -> Web?
Message-Id: <8iprb3$frf$1@orpheus.gellyfish.com>

On Mon, 19 Jun 2000 19:21:38 GMT Syrag wrote:
> I am looking for a way to get my alpha pager (which has no e-mail
> address but has a web interface) to receive e-mail.
> 

If you want to do this in Perl then you will probably want to use the
module LWP::UserAgent to interact with the web interface.


/J\
-- 
** This space reserved for venue sponsor for yapc::Europe **
              <http://www.yapc.org/Europe/> 


------------------------------

Date: Wed, 21 Jun 2000 01:37:27 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: Urgent help with non-blocking child process required
Message-Id: <r%U35.2732$Qf6.80347@nuq-read.news.verio.net>

In article <XAI35.1176$yc1.59975@news1.rdc1.on.wave.home.com>,
 <salim@cygnos.com> wrote:
>data to snippetB's STDIN. My problem is that when this happens, snippetA
>waits until snippetB returns. What I want to be able to do is let A to
>continue to execute the loop (hence fork/execing two or more children)
>without waiting for any of them to return. so far I haven't had any luck

You might consider changing logic so that your grandchildren do the I/O
instead of a direct child.  If the direct child exits while the grandchildren
are still active, they will become wards of process 1 (which means they
won't bother you, and won't become zombies).  The parent can go back to
its main loop after reaping the dead child.

while(1) {
  $client = $listensock->accept();      # Wait for client to connect
  if (fork()) {		# Create a temporary child
    close($client);     # Parent: let child have exclusive access to socket
    wait();             # Temporary child will exit right away; reap it
  } else {
    fork() and exit;    # Temporary child creates 3rd generation and dies
    if (fork()) {
      print "Grandchild 1: code to handle input goes here";
    } else {
      print "Grandchild 2: code to handle output goes here";
    }
  }
}       # Go back to waiting for another client to connect.
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.


------------------------------

Date: 21 Jun 2000 08:44:37 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Viewing Multipart/Mixed messages
Message-Id: <8iprp5$frs$1@orpheus.gellyfish.com>

On Mon, 19 Jun 2000 19:46:22 -0700 Ramesh Vadlapatla wrote:
> Hello!
> 
> Let's say I have a multipart/mixed message that contains:
> Content-Type: TEXT/PLAIN; charset=US-ASCII
> and
> Content-Type: APPLICATION/octet-stream; name="test.JPG"
> 
> How would I display this file(message) in a browser and display both
> Text as well as the jpg?
> 

I would start with one of the modules in the Mime-Tools package
available from CPAN ...


/J\
-- 
** This space reserved for venue sponsor for yapc::Europe **
              <http://www.yapc.org/Europe/> 


------------------------------

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>


Administrivia:

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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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 V9 Issue 3438
**************************************


home help back first fref pref prev next nref lref last post