On Friday 31 Jan 2003 8:56 am, Angerstein wrote: > Hello there! > Sorry, if you get this mail two time. > > I have a question regarding named pipes (mknod mypipe p). > > I have 2 programmes, one is not opensource nor programmed by me. > The 2. programm is programmed by me. > > The 1. writes into a pipe. > The 2. should read from the pipe. > > So far so good. > > The problem is if the first programm canīt write to the pipe it dies. > So it dies when the pipe is a) full (size canīt be increased) or b) > blocked. > > With the newer Perl-Versions 5.6 and higher there is IO::Handle with > getline. > Which should theoretically work, but I donīt know if and how. > > With the old perl verion 5.00.5, iīm damed to use, there is no such modul, > and I have no idea, after testing so much stuff, how it could work. > > If anyone has a good idea or some code I would be very happy. > > > Thanks! > > Bastian
Here's a couple of test scripts I wrote before creating a daemon that sat around waiting for instructions from a number of clients. It has a timeout on the read so it can perform other functions . These both worked with Perl 5.005_02 on an AIX box. $ more rwlprd # writer #!/usr/bin/perl -w select(STDERR); $|=1; select(STDOUT); $|=1; chdir $ENV{RWDDATA} || die "cannot cd: $!\n"; die "pipe is missing\n" unless ( -p "rwfifo"); eval { local $SIG{ALRM} = sub {die "alarm clock restart" }; alarm 10; open(FOUT,">rwfifo") || die "$!"; print FOUT "NPNN ICL00000.LP\n"; close(FOUT); alarm 0; }; if ( $@=~/alarm clock restart/) { print "write to pipe failed, processing alternative\n"; } else { print "write to pipe worked, I'm outa here\n"; } $ cat rwlprp # reader #!/usr/bin/perl -w select(STDERR); $|=1; select(STDOUT); $|=1; my $inp; chdir $ENV{RWDDATA} || die "cannot cd: $!\n"; die "pipe is missing\n" unless ( -p "rwfifo"); eval { local $SIG{ALRM} = sub {die "alarm clock restart" }; alarm 20; open(FOUT,"rwfifo") || die "$!"; $inp=<FOUT>; close(FOUT); alarm 0; }; if ( $@=~/alarm clock restart/) { print "read from pipe failed\n"; } else { print "read from pipe worked, I've got '$inp'\n"; } $ -- Gary Stainburn This email does not contain private or confidential material as it may be snooped on by interested government parties for unknown and undisclosed purposes - Regulation of Investigatory Powers Act, 2000 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]