Seems to me if you want to view the file while your aps running you
probably should be closing the file between writes anyway.
Just a though.
Basil
"ck"
<[EMAIL PROTECTED]> To: "Sabherwal, Balvinder
\(MBS\)"
Sent by: <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] <[EMAIL PROTECTED]>
veState.com cc:
Subject: Re: Writing to
output file on Solaris
18/03/2003 11:19 AM
you can try just putting the line $|=1; before the 'if' statement begins
ck
----- Original Message -----
From: "Sabherwal, Balvinder (MBS)" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 18, 2003 5:06 PM
Subject: RE: Writing to output file on Solaris
> Here is what I change my script and changed the print FH to print $oldfh.
> Now all the output is going to the screen and not to the file. I was
using
> the strict before and got the error as "Can't use string ("main::STDOUT")
as
> a symbol ref while "strict refs" in use at rep_tp.pl line 78.". after
> disabling the use of strict, output goes to the screen not to file. Any
> Ideas??
>
> if ( $opt_f )
> {
> $outfile =
"$opt_f"."/"."$opt_S"."_"."$opt_s"."_"."$opt_d".".throughput";
> if ( -e $outfile )
> {
> die "\n\n *** ERROR *** Write permission denied on $outfile \n"
unless(
> -w $outfile );
> die "*** Error *** Cannot open the file $opt_f to send output\n" if
(
> !open(FH,">> $outfile") );
> }
> else
> {
> die "*** Error *** Cannot open the file $opt_f to send output\n" if
(
> !open(FH,"> $outfile") );
> }
> $oldfh = select FH ; $| = 1 ; select $oldfh ;
> }
>
> -----Original Message-----
> From: Steven McDowall [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 18, 2003 11:55 AM
> To: Sabherwal, Balvinder (MBS)
> Cc: [EMAIL PROTECTED]
> Subject: Re: Writing to output file on Solaris
>
>
>
> You need to turn autoflush(1) on for that filehandle..
>
> my $oldfh = select FH ; $| = 1 ; select $oldfh ;
>
> This should, of course, be done after you know FH was opened correctly
> :-)
>
> On Tuesday, March 18, 2003, at 10:39 AM, Sabherwal, Balvinder (MBS)
> wrote:
>
> > Guru's
> >
> > I have a script which writes to a file. For some reason, I see the
> > writes
> > are being buffered. The file gets created as soon as I execute the
> > script. I
> > don't see anything in the output file till the script ends.
> >
> > Is there any way I can change this behavior so I can keep writing to
> > the
> > file and will be able to see the data in the output file while the
> > script is
> > still running. I an doing print to file handle in a loop. The file is
> > open
> > for the write mode via the below syntax.
> >
> > if ( -e $outfile )
> > {
> > die "\n\n *** ERROR *** Write permission denied on $outfile \n"
> > unless(
> > -w $outfile );
> > die "*** Error *** Cannot open the file $opt_f to send output\n"
> > if (
> > !open(FH,">> $outfile") );
> > }
> > else
> > {
> > die "*** Error *** Cannot open the file $opt_f to send output\n"
> > if (
> > !open(FH,"> $outfile") );
> > }
> >
> > Thanks
> > _______________________________________________
> > ActivePerl mailing list
> > [EMAIL PROTECTED]
> > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> _______________________________________________
> ActivePerl mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs