[prev in list] [next in list] [prev in thread] [next in thread]
List: perl-win32-users
Subject: Re: Printing to a file while socket is open..
From: "$Bill Luebkert" <dbe () wgn ! net>
Date: 2001-05-31 20:34:34
[Download RAW message or body]
Craig S Monroe wrote:
>
> Hello All,
>
> I am a newbie to the list and have a question. I have searched for an answer
> through the
> docs, but cannot seem to locate a resolution.
>
> I have written a script that opens a socket to a particular device,
> and issues it commands. I would then like it to write the results to a
> file, wait, then issue the
> commands again and append the results to the same file.
>
> My issue:
>
> I am having difiiculty writing the output to a file.
> The file is created, but nothing is written and the script hangs.
> It worked previously, when I had the script close the socket, then write the
> results, but I need to keep it open.
>
> I have really hacked up the script(indecision on items) so please look past
> the rubble. It will be cleaned up when it is done.
> I have enclosed the portion of the script. The part I am having difficulty
> with
> is toward the end when printing to DATAFILE.
...
> open(DATAFILE,">>$dataFile")||
> die "cannot append to $dataFile : $!";
You could unbuffer the output to the file here (the below maintains
STDOUT as the selected FH):
select ((select (DATAFILE), $| = 1)[0]);
...
--
,-/- __ _ _ $Bill Luebkert ICQ=14439852
(_/ / ) // // DBE Collectibles http://www.todbe.com/
/ ) /--< o // // Mailto:dbe@todbe.com http://dbecoll.webjump.com/
-/-' /___/_<_</_</_ http://www.freeyellow.com/members/dbecoll/
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic